View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default count in a string

from the immediate window you can see this returns 2:
TheStringIN = "F000025"
? Application.CountA(TheStringIn, "0")
2


It will return 1 for each non blank argument. You have supplied 2 non-blank
arguments, so it returns 2.

so similarly:
TheStringIN = "F99999"
? Application.CountA(TheStringIn, "0")
2

--
Regards,
Tom Ogilvy



"Ken Valenti" wrote:

Try this

Sub CountInString()
Dim COuntIt
Const TheStringIn = "F000025"
MsgBox Application.CountA(TheStringIn, "0")
End Sub


"SHIRA" wrote:

Hi,
I have a string that lools like this "F000025"
I would like to build a macro that count how many zero i have in my string
(4 for this example)
or maybe there is a vba function that does that.

Anyone?