kevinh2320
Board Regular
- Joined
- May 13, 2016
- Messages
- 61
I'm using the code below which works great provided the word "Remove" is somewhere on the sheet in column F. However, when the code runs on a worksheet where the word "Remove" is not present it removes the first row of the worksheet which is the column headings and also removes my alternate row colors. I'd like to modify this code or, new code that will eliminate this issue.
'Delete rows for Leases worksheet that contain the word "Remove" - column F
Worksheets("Leases").Activate
With ActiveSheet
.AutoFilterMode = False
With Range("F1", Range("F" & Rows.Count).End(xlUp))
.AutoFilter 1, "*Remove*"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
Thanks for any help.
'Delete rows for Leases worksheet that contain the word "Remove" - column F
Worksheets("Leases").Activate
With ActiveSheet
.AutoFilterMode = False
With Range("F1", Range("F" & Rows.Count).End(xlUp))
.AutoFilter 1, "*Remove*"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
Thanks for any help.