I have written code to delete the row containing "Company Name" from row 2 onwards in Col A
when running the code, I get a "compile error: Next without for"
it would be appreciated if someone could kindly assist me
Code:
Sub Del_Unwanted()
Dim LR As Long, i As Long
With Sheets(1)
For i = LR To 2 Step -1
LR = .Range("A" & Rows.Count).End(xlUp).Row
If .Range("A" & i).Value = "Company Name" Then
.Range("A" & i).EntireRow.Delete
Next i
End With
End Sub
when running the code, I get a "compile error: Next without for"
it would be appreciated if someone could kindly assist me