how to count Data Carrecter without space

  • Thread starter Thread starter character counts
  • Start date Start date
character counts said:
Data character count function


If I understand correctly, that you want to count the number of characters
in a string ignoring any spaces in the string, then the following function
should do it ...

Public Function CountIgnoringSpaces(ByVal InputString As String) As Long
CountIgnoringSpaces = Len(Replace(InputString, " ", vbNullString))
End Function

Example of use, in the Immediate window ...

? countignoringspaces("abc def")
6
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top