Hi!
I want to figure out that how many special characters are there in a string.
But I can’t find a solution. Here is my code.
Sub CountChar() Dim SearchString, SearchChar, MyPos SearchString = “Character” SearchChar1 = “a” SearchChar2 = “r” MyPos1 = InStr(1, SearchString, SearchChar1) MyPos2 = InStr(1, SearchString, SearchChar2) MsgBox “There are ” & MyPos1 & ” (a) and ” & MyPos2 & ” (r) characters in your string” End Sub
It should be “2 a” and “2 r”