Human_doing
Board Regular
- Joined
- Feb 16, 2011
- Messages
- 137
Hi all,
Can anyone please correct the below code, which is supposed to cycle through all worksheets in a workbook and place the number of occurences of the term 'C22' in row D in cell N2 of each sheet? However it doesn't actually seem to do anything in this format.
Thanks
Can anyone please correct the below code, which is supposed to cycle through all worksheets in a workbook and place the number of occurences of the term 'C22' in row D in cell N2 of each sheet? However it doesn't actually seem to do anything in this format.
Thanks
Code:
Sub Looper()
Dim Sh As Worksheet
Dim LR As Long
For Each Sh In ActiveWorkbook.Worksheets
With Sh
Dim x As Long
x = Range("D" & Rows.Count).End(xlUp).Row
Range("N2") = Application.WorksheetFunction.CountIf(Range("D2:D" & x), "C22")
End With
Next Sh
End Sub
Last edited: