I have the following code in VBA that is returning an 1004 error:
e = WorksheetFunction.CountIf(Worksheets("TG Teams").Range(Cells(4, w), Cells(12, w)), Worksheets("Calcs").Range("B" & a))
e, w, and a are all integers.
The code is meant to check if a name in the Calcs sheet also appears in a TG Teams sheet. The reason that the range is variable is that the CountIf needs to check a different column each week.
Any ideas how to resolve the error 1004 I get when I run this?