Reputation: 15
I am relatively new to Excel VBA script and am having trouble with the syntax quotes here on this line
ActiveSheet.Range("H" & EndRowH + 2).Formula = "=SUMIFS(H2:H &EndRowH & ,C1:C1000,&"">=""&lngStart&)"
Let me know if you need any other details.
Upvotes: 1
Views: 944
Reputation:
Both the criteria range and the sum range need to be the same number of rows.
ActiveSheet.Range("H" & EndRowH + 2).Formula = "=SUMIFS(H2:H" & EndRowH & ", C2:C" & EndRowH & ", "">=" & lngStart &""")"
Your original formula had the sum range start at H2 while the criteria range started at C1. While you can offset the sum range and the criteria range if necessary, they still have to be the same number of rows.
ActiveSheet.Range("H" & EndRowH + 2).Formula = "=SUMIFS(H2:H" & EndRowH & ", C1:C" & EndRowH - 1 & ", "">=" & lngStart &""")"
Upvotes: 1