I am attempting to utilize a SumIf function to iterate down a table of names, and to sum all "Performance Savings" attributed to each name in a separate data table.
My code is below. When I run the macro, it crashes on the SumIf line. When I remove the '=' character before the SumIf function to assign the cellvalue as a string rather than formula, the macro runs fine, and the string is exactly what I would like it to be. I'm not sure why it crashes when I then make the SumIf line a formula.
I have attempted to reference analogous historic threads without success. Appreciate any help I can receive!
Dim tempStr As String
For y = 1 To (b - 3)
ActiveSheet.Cells((a + 1 + y), 1).Select
tempStr = ActiveCell.Value
Sheets("Pivot").Cells((a + 1 + y), 5).FormulaR1C1 = _
"=SUMIF('Performance Savings'!$B$2:$B$200," & Chr(34) & tempStr & Chr(34) & ",'Performance Savings'!$C$2:$C$200) "
Next y