I have account numbers in Col A & B
where the account number starts with an X in Col A and b from row 2 onwards, i would like to clear these using a macro
I have tried to write code, but get a compile error "Next without for"
i have attached my sample data
It would be appreciated if someone could resolve this
Sub Clear_X_accounts()
Sheets("Accounts").Select
Finalrow = Cells("A65536").End(xlUp).Row
For i = Finalrow To 2 Step -1
If Cells(i, 1).Value Like "*X*" Then
Cells(i, 1).EntireRow.Clear
If Cells(i, 2).Value Like "*X*" Then
Cells(i, 2).EntireRow.Clear
End If
Next i
End Sub
Bookmarks