Hi All,
I am using sumproducts in VBA and I have below code:
instead of AI!$AY$2:$AY$366 in above code I want to refer to the last column of sheet AI. How can I change that in above code?![]()
Dim i As Integer lc = Sheets("sheet2").Cells(3, Columns.Count).End(xlToLeft).Column AIlc = Sheets("AI").Cells(2, Columns.Count).End(xlToLeft).Column For i = 1 To 12 Cells(2 + i, lc + 1) = Application.Evaluate("SUMPRODUCT((MONTH(AI!$B$2:$B$366)=" & i & ")*(AI!$AY$2:$AY$366))") Next i
Thanks,
Bookmarks