I have the following macro below to delete rows from row 2 onwards containing "Reference" in Col A
I add code below, then it works
Kindly amend my code so I do not need to include on error resume next
Your assistance in this regard is most appreciated
Code:
Sub Del_Unwanted()
Dim LR As Long, i As Long
With Sheets("Data Import")
If .Range("A2") = "" Then
.Range("A1").EntireRow.Delete
Else
End If
LR = .Range("A" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
'On Error Resume Next
If .Range("A" & i).Value = "Reference" Then .Range("A" & i).EntireRow.Delete
Next i
.UsedRange.EntireColumn.AutoFit
End With
End Sub
I add code below, then it works
Code:
'On Error Resume Next before
If .Range("A" & i).Value = "Reference" Then .Range("A" & i).EntireRow.Delete
Kindly amend my code so I do not need to include on error resume next
Your assistance in this regard is most appreciated