I have headers in Col A with text "Reference"
I want to delete the rows containing text "Reference" except the first row containing this
However when run my macro, I get Type mismatch
It would be appreciated if someone could kindly amend my code
I want to delete the rows containing text "Reference" except the first row containing this
However when run my macro, I get Type mismatch
Code:
Sub Del_Unwanted()
Dim LR As Long, i As Long
With Sheets("Data Import")
LR = .Range("A" & .Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
If .Range("A" & i).Value = "Reference" Then .Range("A" & i).EntireRow.Delete
Next i
.UsedRange.EntireColumn.AutoFit
End With
Columns("L:L").ColumnWidth = 64.86
End Sub
It would be appreciated if someone could kindly amend my code