I'd like to create a macro that inserts the following IF statement into cell S3, and copy it down the S column to the last row of data. I have a formula that works for simple calculations, but I can't get it working with my IF statement. Here's what I'm currently doing:
Sub FormulaFill()
Dim LastRowColumnA As Long
LastRowColumnA = Cells(Rows.Count, 1).End(xlUp).Row
Range("W3:W" & LastRowColumnA).Formula = "=IF(T3="","",IF(R3=1,1,IF(V3=0,N2,IF(T3<>"",T3&"SS"&ROUNDUP(U3,0),""))))"
End Sub
My IF statement works fine if I manually insert it and drag it down. Any idea why this won't work?
Sub FormulaFill()
Dim LastRowColumnA As Long
LastRowColumnA = Cells(Rows.Count, 1).End(xlUp).Row
Range("W3:W" & LastRowColumnA).Formula = "=IF(T3="","",IF(R3=1,1,IF(V3=0,N2,IF(T3<>"",T3&"SS"&ROUNDUP(U3,0),""))))"
End Sub
My IF statement works fine if I manually insert it and drag it down. Any idea why this won't work?