jeudi 22 juin 2017

Excel VBA: How to write IF statemnt for entire used range?

I am having some trouble with my code. I am trying to use an IF statement for an entire column until the rows within the IF statement end. When I try to run my code it says "Error 1004: 'Application defined or object defined error." Here is my code so far:

Sub AddColumn()
Range("L1").Formula = "=IF(OR(LEFT($G1,2)=""55"",LEFT($G1,2)=""45"",$G1=""FORECAST""),$G1,""No"")"
'It works until this line:
        Range("L1", "L" & Cells(Rows.Count, 1).End(xlUp).Row).FillDown
        End Sub

Aucun commentaire:

Enregistrer un commentaire