strings in a range

  • Thread starter Thread starter Peter Morris
  • Start date Start date
P

Peter Morris

what's a function I can use in VB to count the
number of times a particular string occurs in
a named range of cells?
 
Application.Countif(Range("myRange"),"string")

as an example

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Bob Phillips said:
Application.Countif(Range("myRange"),"string")

as an example

That works.

also, is it possible to use wildcards in the search string?

Or to count the number of cells in the range with ANY
text in?
 
Application.Countif(Range("myRange"),"*string*)

Application.CountA(range("MyRange"))
 
Tom Ogilvy said:
Application.Countif(Range("myRange"),"*string*)

Application.CountA(range("MyRange"))

Brilliant, much gratitude to both of you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top