【发布时间】:2014-04-02 16:35:34
【问题描述】:
我查看了其他链接,但似乎没有一个可以帮助我。我正在为一个程序编写代码,该程序将计算一个短语中的所有逗号。我不是编程新手,但我是 VBA 新手。
Sub examp()
Dim s As String
Dim i, my_c As Integer
i = 0
s = ",jkqk;j,oiheqfjnq;ef,jwhef;ur,jwefun;jwkbnf," '<-------arbitrary, however, when I tried to make it input from a textbox it gave me error 424 as well, so I just defined it as random chars with commas
While i < Len(s)
For i = 0 To Len(s) - 1
j = s.Chars(i) <----------------------------------Error occurs here
If j = "," Then
my_c = my_c + 1
End If
Next i
Wend
Count.Text = "my_c"
End Sub
【问题讨论】:
标签: vba excel runtime-error