I'm using the following VBA code to insert a formula into a range
I want the resulting formula to look like:
=MAX(IF(I3:I23<0,H3:H23))
but the code is producing:
=MAX(IF(@I3:I23<0,H3:H23))
which does not return the correct "H" for rows in which column "I" has a positive value.
I'm at a loss to know how to remove the "@" symbol from the formula created by the vba code.
VBA Code:
dataRng.Columns(4).Range("A" & MAWindow + 2 & ":A" & lastRow).FormulaR1C1 = _
"=max(if(R[-" & MAWindow - 1 & "]C[" & colDiff + 2 & "]:RC[" & colDiff + 2 & "]<0,R[-" & MAWindow - 1 & "]C[" & colDiff + 1 & "]:RC[" & colDiff + 1 & "]))"
I want the resulting formula to look like:
=MAX(IF(I3:I23<0,H3:H23))
but the code is producing:
=MAX(IF(@I3:I23<0,H3:H23))
which does not return the correct "H" for rows in which column "I" has a positive value.
I'm at a loss to know how to remove the "@" symbol from the formula created by the vba code.