View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default counting a specific "text" occurance in a selection of sheets within a workbook

On Sun, 26 Sep 2010 09:13:06 -0700 (PDT), Johnnyboy5
wrote:

For Each ws In Worksheets
Set mycol = ws.Columns("N")
mc = mc + Application.CountIf(mycol, "Hello")
Next ws


Change to:

For Each ws In Worksheets
Select Case ws.name
Case "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
Set mycol = ws.Columns("N")
mc = mc + Application.CountIf(mycol, "Hello")
end select
Next ws