我试图显示在VBA Excel中已定义为字符串的数组的输出。但是,我没有得到想要的输出。这是我的代码:
Sub myArray()
Dim dayArray(0 To 6) As String
i = dayArray(i)
dayArray(0) = "Sunday"
dayArray(1) = "Monday"
dayArray(2) = "Tuesday"
dayArray(3) = "Wednesday"
dayArray(4) = "Thursday"
dayArray(5) = "Friday"
dayArray(6) = "Saturday"
For i = 0 To 6
MsgBox "Today is "
Next
End Sub
我正在尝试根据字符串输出星期几。如何确保我将当天作为消息框?
答案 0 :(得分:0)
只需结束这个问题即可
Sub myArray()
Dim dayArray(0 To 6) As String
dayArray(0) = "Sunday"
dayArray(1) = "Monday"
dayArray(2) = "Tuesday"
dayArray(3) = "Wednesday"
dayArray(4) = "Thursday"
dayArray(5) = "Friday"
dayArray(6) = "Saturday"
Dim i as Long
For i = 0 To 6
MsgBox "Today is " & dayArray(i)
Next
End Sub