View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Search text & record number of times it appears

Here's a shorter version


Sub CountCells()
Dim findText as String, found as Long
findText = "dog"
Found = application.Countif(worksheets(1).Range("A1:Z26"), _
"*" & findText & "*")
MsgBox "Found " & Found & " instances of " & findText
End sub

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
That was quick. Worked like a charm. Thanks a million

regards,
Julian