VBA:variables别名

重新构build了这个问题:我使用了一个范围(包含头文件)来定义一个数组,我初始化并从表中提取数据。 事情进展顺利(冗余和重复代码),但我可以直接写入数组到Excel行。

但是代码需要validation和初始化,因此我将其迁移到封装了两个需求的类中。 dynamic实现需要用InsertLines重写类。

问题是,现在我有一个类的数据,但我不知道如何写它到一个单一的行。

以前的algorithm:

 Dim MyRange as Range Dim sTR() as string 'set myrange to a specific range of cells' 'Redim the sTR array to match the number of unique variables in the range 'Extract values from multiples rows in a table to the sTR array' 'Write the array to the Excel file with:' MyRange.Offset(x, y).value = sTR() 

现行方式:

 Dim MyRange as Range 'set myrange to a specific range of cells (Nine columns and variable rows)' 'InsertCode into a class module with all unique values in the range as public variables Dim sTR as ClassX Set sTR as New ClassX 'Extract values from multiples rows in a table to the sTR Class' 

现在的问题是,我不知道类中variables的顺序(这与前面使用数组的方法没有关系,但是这种方式肯定会涉及太多的代码冗余)。

请帮助! 想知道一个variables是否可以通过不同的名称(别名)来解决,这将解决我的问题。 还是有办法解决一个类中的所有公共variables(比如说循环)?