展开全部
Sub test()
Dim 数组() As Integer '定义动态数组
Dim n As Long
Dim i As Integer
n = Application.WorksheetFunction.CountA(Range("A:A")) '确定A列数据数量
ReDim 数组(1 To n) As Integer '根据A列数据重新定义数组
For i = 1 To n
数组(i) = Cells(i, 1) '给数组赋值
Next
End Sub
Dim 数组() As Integer '定义动态数组
Dim n As Long
Dim i As Integer
n = Application.WorksheetFunction.CountA(Range("A:A")) '确定A列数据数量
ReDim 数组(1 To n) As Integer '根据A列数据重新定义数组
For i = 1 To n
数组(i) = Cells(i, 1) '给数组赋值
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |