View Single Post
  #2   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

s = "F000025"
cnt = len(s) - len(Application.Substitute(s,"0",""))

in xl2000 or later you can use replace

s = "F000025"
cnt = len(s) - len(replace(s,"0",""))


--
Regards,
Tom Ogilvy

"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?