【发布时间】:2015-07-24 07:42:29
【问题描述】:
嘿,我是 vba 新手,我已经尝试寻找我的问题的答案。 我想用可以在表中更改的特定数组填充动态数组。为此,我创建了以下代码:
Sub ZellenArrayReader()
Dim boom() As Variant
Dim rowsboom As Integer
Dim sh As Variant
sh = "TAB1"
Worksheets(sh).Range("A1").Select
rowsboom = Selection.CurrentRegion.Rows.Count - 2
ReDim boom(0 To rowsboom)
For i = LBound(boom) To i = UBound(boom)
boom(i) = Worksheets(sh).Cells(i + 2, 1)
Next i
Cells(10, 5).FormulaR1C1 = boom(0)
Cells(10, 1).FormulaR1C1 = boom(1)
End Sub
for 部分是 on e 不能正常工作。即使数组的 Upperbound 是 4 或 5,它也只运行一个代码。
【问题讨论】: