count how often a name exists
Dim CntJack()
Dim sh as Worksheet, cnt as long
for each sh in activeworkbook.worksheets
cnt = cnt + application.countif(sh.range("C6:F40"),"Jack")
Next
msgbox "Jack cnt is " & cnt
End Sub
If the Jack could be part of a larger string use
cnt = cnt + application.countif(sh.range("C6:F40"),"*Jack*")
or for Jack at the beginning of a string
cnt = cnt + application.countif(sh.range("C6:F40"),"Jack*")
--
Regards,
Tom Ogilvy
"hans" wrote in message
...
I want to know how often a name (say jack) occurs in a spreadsheet.
The name has to be found in the range c6:f40 but.........
i have 50 sheets. named 1, 2, 3, 4, .......50
and i want to know the sum of how often a name occurs in all sheets
together.
I think this has to be done in vba!
Can someone help me?
Greetings Hans
|