I am sort of a novice with VBA. running into an issue. I am trying to say If this value in this table is 2 then execute these formulas if not stop and give a message "Not Done."
If "=VLOOKUP(D8,'Sheet'!B:J,9,false)" = 2 Then
Range("I8").Select
ActiveCell.Formula = "=VLOOKUP(D8,'Sheet'!B:J,2,false)"
Range("J8").Select
ActiveCell.Formula = "=VLOOKUP(D8,'Sheet'!B:J,3,false)"
Range("K8").Select
ActiveCell.Formula = "=G8-N8"
Else
Range("J8").Select
ActiveCell.Formula = "Not Done"
Range("K8").Select
ActiveCell.Formula = "Not Done"
Range("I8:K8").Select
Selection.AutoFill Destination:=Range("I8:K" & Range("A" & rows.count).End(xlUp).row)
Range(Selection, Selection.End(xlDown)).Select
If "=VLOOKUP(D8,'Sheet'!B:J,9,false)" = 2 Then
is problematic because"=VLOOKUP(D8,'Sheet'!B:J,9,false)"
is just text (String
), not a formula that is evaluated. It's no different than sayingIf "abracadabra" = 2
. – BigBen