I have code in visual basic that applies a formula all the way down to where the data ends for column D. When I use a vlookup formula, the code works. Below is the code that works:
Sub FillFormula()
Sheets("On Order").Range("Z4:Z" & Sheets("On Order").Range("D" & Rows.Count).End(xlUp).Row).Formula = "=VLOOKUP(V4,Sheet1!$A$1:$D$65000,4,0)"
End Sub
However, when I try to plug in any kind of IF formula, the code doesn't work:
Sub FillFormulaI()
Sheets("On Order").Range("AA4:AA" & Sheets("On Order").Range("D" & Rows.Count).End(xlUp).Row).FormulaR1C1 = "=IF(IFERROR(AB4,"")="","","bulk")"
End Sub
Does anyone know how I can get an if formula to work?
I apologize if I didn't adhere to all the polices for posting. First time in years posting a question here.
Thanks!
Sub FillFormula()
Sheets("On Order").Range("Z4:Z" & Sheets("On Order").Range("D" & Rows.Count).End(xlUp).Row).Formula = "=VLOOKUP(V4,Sheet1!$A$1:$D$65000,4,0)"
End Sub
However, when I try to plug in any kind of IF formula, the code doesn't work:
Sub FillFormulaI()
Sheets("On Order").Range("AA4:AA" & Sheets("On Order").Range("D" & Rows.Count).End(xlUp).Row).FormulaR1C1 = "=IF(IFERROR(AB4,"")="","","bulk")"
End Sub
Does anyone know how I can get an if formula to work?
I apologize if I didn't adhere to all the polices for posting. First time in years posting a question here.
Thanks!