It worked as soon as I set the focus to shtGroup via Activate and removed the extra quotes for a numeric value.
What is the point of the double negatives "--" at the beginning of each range?
Microsoft Excel
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.
If lngGroup and lngSub are numeric
result = Evaluate("SUMPRODUCT(--(A1
If they are strings:
result = strformula = "SUMPRODUCT(--(A1:A50=""" & lngGroup & """), --(B1:B50=""" & lngSub & """))"