Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VBA在调整结构(类型)中数组的大小时出现问题_Vba_Types - Fatal编程技术网

VBA在调整结构(类型)中数组的大小时出现问题

VBA在调整结构(类型)中数组的大小时出现问题,vba,types,Vba,Types,对于我在VBA中的项目,我需要有如下自定义类型: Public Type Gene Name As String Expression() As Double 'holds data points, is a vector Norm_Expression() As Double 'Holds normalized data, is a vector Min_Corr As Double Min_Profile As Integer E

对于我在VBA中的项目,我需要有如下自定义类型:

Public Type Gene
  Name As String 
  Expression() As Double             'holds data points, is a vector
  Norm_Expression() As Double        'Holds normalized data, is a vector
  Min_Corr As Double
  Min_Profile As Integer 
End Type
但我发现很难通过redim语句更改内部数组的大小

ReDim Data(n)
For i = 1 To n
   ReDim Preserve Data.Expression(Max_Time_Point)
Next i
不起作用。也没有:

For i = 1 To n
    ReDim Data(n).Expression(Max_Time_Point)Does not work. Neither does:
Next i

你能帮忙吗?谢谢大家!

就快到了-您需要指出您要处理的
数据
的哪个成员:

For i = 1 To n
   ReDim Preserve Data(i).Expression(Max_Time_Point)
Next i
注意,当你这样做

ReDim Data(n)

它与ReDim Data(0到n)相同,因此在循环中,如果从1开始,则会错过第一个元素。

@tim williams无效限定符