One way (checks for any case also)
Sub countpart()
For Each c In Range("g2:g22")
If InStr(UCase(c), "ABC") Then ctr = ctr + 1
'If InStr(c, "abc") Then ctr = ctr + 1'for abc ONLY (no case check)
Next c
MsgBox ctr
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Colin Hempsey" <(E-Mail Removed)> wrote in message
news:3E2E1182-0C1E-4D02-B291-(E-Mail Removed)...
>I am trying to count how many times a specific string "abc" forms part of a
> cell in a spreadsheet.
>
> For example
>
> abcgfd, abcdse, efgabc would be vaild and I would like to count these
>
> abdcef, bcadef, cbaeds would not be valid and I would not want to count
> these.
>
> Can anyone help point me in the right direction?
>
> Thanks.