Private Sub subst()
Dim temp1 As String
temp1 = "Test,test,TEst"
Dim i As Integer
i=0
Dim temp(3) As String
For i=0 To 2
temp(i) = Split(temp1,",")
Next i
现在,在运行代码时弹出一条错误消息
“运行时错误'13':类型不匹配”
答案 0 :(得分:0)
固定的代码可能看起来像这样
Private Sub Subst()
Dim temp1 As String
temp1 = "Test,test,TEst"
Dim i As Long
Dim temp As Variant
temp = Split(temp1, ",")
For i = LBound(temp) To UBound(temp)
Debug.Print temp(i)
Next i
End Sub
正如我在评论中所言,您可以为初学者和其他掌握宏观知识的读者找到相当不错的阅读材料