I am having trouble with an error code 1004. I am attempting to have a SUMIF formula in my VBA code. My objective is to Sum Column F from F2 to the lastrow. the column has Vlookup values that include "#N/A". The formula used without VBA is
=SUMIF(F2:F3509, "> 0")
My attempted formula in VBA is
lastRow = Range ("A1048576").End(xlup).Row
Range("D" & lastrow) = "=SUMIF(F2:F, ""> 0""" & lastrow & ")"
. Any help would be much appreciated. Thank you very much. Matt
Try
Lastrow = Range("A1048576").End(xlUp).Row + 1
Range("D" & Lastrow) = "=SUMIF(F2:F" & Lastrow & "," & Chr(34) & "> 0" & Chr(34) & ")"