我想创建一个值数组:w1,w2,w3,y1,y2,y3 ......等,但在我的代码中出错:
sub array()
Dim titles() as string
For i = 1 to 3
titles(i + 0) = "w" + i
titles (i + 3) = "y" + i
titles (i + 6) = "x" + 1
'...
Next i
End sub
答案 0 :(得分:1)
你很亲密:
Sub arrray()
Dim titles(1 To 9) As String
Dim i As Long
For i = 1 To 3
titles(i + 0) = "w" & i
titles(i + 3) = "y" & i
titles(i + 6) = "x" & i
Next i
For i = 1 To 9
MsgBox titles(i)
Next i
End Sub