MsgBox Len(myString) - Len(Replace(Replace(Replace(myString, " ", ""),
".", ""), ",", ""))
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Rahul Gupta" <(E-Mail Removed)> wrote in message
news:2CD7BBCB-154C-4BE2-8AF7-(E-Mail Removed)...
> Hello Again Gary,
>
> SUBSTITUTE is not working in VBA? It is a worksheet function, as u have
also
> mentioned. Any other way?
>
> This method wont help.
>
> Regards,
> Rahul.
>
> "Gary''s Student" wrote:
>
> > In the worksheet use a combination of LEN() and SUBSTITUTE():
> >
> > =LEN(A1)-LEN(SUBSTITUTE(A1," ","")) will count the number of spaces
> > =LEN(A1)-LEN(SUBSTITUTE(A1,",","")) will count the number of commas, etc
> > --
> > Gary's Student
> >
> >
> > "Rahul Gupta" wrote:
> >
> > > Hello,
> > >
> > > How can i count Count Space, comma and fullstop in a string through
macro.
> > >
> > > For Ex. if A1= My name is Rahul. Then B1=4
> > > For Ex. if A1= My name is Rahul, my brother's name is NewName & our
surname
> > > is Gupta. Then B1 =14
> > >
> > > and so on.
> > >
> > > Thanks in advance,
> > >
> > > Rahul
|