View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stefi[_2_] Stefi[_2_] is offline
external usenet poster
 
Posts: 25
Default How do you count the number of * in a string?

On Jan 14, 1:22*pm, "michael.beckinsale"
wrote:
Hi all,

Could anybody provide the vba code to count the number of * contained
in the string of a cell. The string has leading 'spaces'

TIA

Regards

Michale


If the string is in C1

occursnumber = Len(Range("C1")) - Len(Replace(Range("C1"), "*", ""))

Regards,
Stefi