I'm using this code to count items on each worksheet in workbook 1. How do alter the code so that this part (ws.Range("C1").Value = cnt) is put into a different workbook? both workbooks have the same sheet names, if that helps.
Thanks!
Thanks!
Code:
Dim ws As Worksheet
With Sheet1
Dim x As Long
x = .Range("A" & Rows.Count).End(xlUp).Row
End With
For Each ws In Worksheets
Dim cnt As Integer
cnt = 0
For i = 1 To x
If ws.Cells(i, 1).Value = ws.Name And ws.Cells(i, 2).Value = "Football" Then
cnt = cnt + 1
End If
Next i
ws.Range("C1").Value = cnt
Next