Hello all
I hope you can help on this please
I am trying to delete any rows that matches "Cancelled" in column "H", this code works ok if there is a row with "Cancelled" but if there are no rows with "Cancelled" then if bugs out, any idea's please on how to fix this
This is the code I have
[Sub Cancelled()
Dim lLRow As Long
With ThisWorkbook.Worksheets("Raw Data ")
lLRow = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("H:H").AutoFilter Field:=1, Criteria1:="Cancelled"
.Range("A2:A" & lLRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete xlShiftUp
.AutoFilterMode = False
End With
]
I hope you can help on this please
I am trying to delete any rows that matches "Cancelled" in column "H", this code works ok if there is a row with "Cancelled" but if there are no rows with "Cancelled" then if bugs out, any idea's please on how to fix this
This is the code I have
[Sub Cancelled()
Dim lLRow As Long
With ThisWorkbook.Worksheets("Raw Data ")
lLRow = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("H:H").AutoFilter Field:=1, Criteria1:="Cancelled"
.Range("A2:A" & lLRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete xlShiftUp
.AutoFilterMode = False
End With
]