View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Johnnyboy5[_2_] Johnnyboy5[_2_] is offline
external usenet poster
 
Posts: 99
Default counting a specific "text" occurance in a selection of sheets withina workbook

Hi

can anyone help me modify the macro below that Don sent to me.

I need it to select a specific range of worksheets. example sheets
1 to 12 named (April, May, June, July ....etc)

rather than selecting all the sheets in the workbook.

thanks

Johnny




Don Guillett Excel MVP
View profile
More options 26 Sep, 13:26
On Sep 26, 4:30 am, Johnnyboy5 wrote:

- Show quoted text -
This might be quicker than a loop for text.
Option Explicit
Sub countjune()
Dim ws As Worksheet
Dim mycol As Range
Dim mc As Long
For Each ws In Worksheets
Set mycol = ws.Columns("N")
mc = mc + Application.CountIf(mycol, "Hello")
Next ws
MsgBox mc
End Sub