The issue is that you cannot perform array comparisons like that in VBA.
I would suggest you redo the calculations using Evaluate:
for examplewc.Cells(2, 4) = ws.Evaluate("SumProduct(--(Month(AN2:AN" & lastRow & ")=2)")
The issue is that you cannot perform array comparisons like that in VBA.
I would suggest you redo the calculations using Evaluate:
for examplewc.Cells(2, 4) = ws.Evaluate("SumProduct(--(Month(AN2:AN" & lastRow & ")=2)")
Be as you wish to seem
Thanks for replying! Unfortunately, when I copied in your example above, it's still gave me a Value Error. I also tried adding "Application." ahead of the Sumproduct function, but that produced the same result. Any thoughts on this would be much appreciated. I've been banging my head against the wall on this one for days.