I'm trying to search column A from the bottom up to delete an entire row if the cell contains the "Customer/" header info.
However my code below keeps deleting all rows?
'Delete Page "Headers" within Body
Range("A:A").Select
Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
'Loop through used cells backwards and delete if needed
For lrow = Lastrow To Firstrow Step -1
Set workrange = Cells(lrow, 4)
If workrange.Value = "Customer/" & Chr(10) & "Invoice Number" Then
workrange.EntireRow.Delete
End If
Next lrow
Ideally, I will need this once working to delete both that row where "Customer/" is found as well the 2 rows above and 2 rows below, which I think I can do with an offset as well?
Bookmarks