I am trying to make a for if statement that returns a value in column b if one of two conditions are met.
Spreadsheet View.JPG

If I put in On Error Resume Next it will skip the if condition and still place a value on the next sheet. How do I get it to ignore the condition if there is no ABC or DEF for other lines?

Sub Code()

Dim totalrows As Long
Dim i As Integer

Sheets("Data").Activate

totalrows = Sheets("Data").UsedRange.Rows.Count

i = 1

For x = 1 To totalrows
If Sheets("Data").Cells(x, 1).Value = 0 Then
If WorksheetFunction.VLookup(Sheets("Data").Cells(x, 2) & "ABC", Sheets("Data").Columns("A:I"), 9, False) > 30 Or WorksheetFunction.VLookup(Sheets("Data").Cells(x, 2) & "DEF", Sheets("Data").Columns("A:I"), 9, False) > 30 Then
Sheets("Notifications").Cells(i, 1) = Sheets("Data").Cells(x, 2)
i = i + 1
End If
End If
Next x

Sheets("Notifications").Select

End Sub