使用split函数,取下标
Sub s() st = InputBox("input string:") ch = InputBox("input character:") For i = 1 To Len(st) If Mid(st, i, 1) = ch Then n = n + 1 Next MsgBox "there is " & n & " " & ch & " in " & stEnd Sub