From: michael.beckinsale on
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
From: Stefi on
On Jan 14, 1:22 pm, "michael.beckinsale"
<michael.beckins...(a)ntlworld.com> 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
From: michael.beckinsale on
Hi Stef,

Thanks very much, works like a dream.

I would never thought of doing that way!

Regards

Michael

From: Stefi on
You are welcome! Thanks for the feedback!
Clicking the YES button will be appreciated.
Stefi

„michael.beckinsale” ezt írta:

> Hi Stef,
>
> Thanks very much, works like a dream.
>
> I would never thought of doing that way!
>
> Regards
>
> Michael
>
> .
>
From: Rick Rothstein on
Another way to count the asterisks (just so you can see that VB is rich with possibilities) is this...

NumberOfAsterisk = UBound(Split(Range("C1"), "*"))

--
Rick (MVP - Excel)


"michael.beckinsale" <michael.beckinsale(a)ntlworld.com> wrote in message news:dcd931bd-b69f-4ddd-8c78-be069a6b6275(a)m3g2000yqf.googlegroups.com...
> Hi Stef,
>
> Thanks very much, works like a dream.
>
> I would never thought of doing that way!
>
> Regards
>
> Michael
>