dversloot1
Board Regular
- Joined
- Apr 3, 2013
- Messages
- 113
Hello,
I'm working through a filter macro to delete unecessary rows of data from my dataset.
- I have a Dynamic Range for my dataset called "CanadaData"
- I'm trying to delete rows from the 5th column of my dataset for cells containing "DIRECTSHIP"
The macro filters the range fine, but when if comes to deleting the row, the macro stops. Any ideas why?
Sub CanadaWarehouseFilter()
x = Range("E" & Rows.Count).End(xlUp).Row
If Application.WorksheetFunction.CountIf(Range("E22:E" & x), "DIRECTSHIP") > 0 Then
With Range("CanadaData")
.AutoFilter
.AutoFilter Field:=5, Criteria1:="DIRECTSHIP"
.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRows.Delete
End With
End If
Range("A2:C2").Select
End Sub
I'm working through a filter macro to delete unecessary rows of data from my dataset.
- I have a Dynamic Range for my dataset called "CanadaData"
- I'm trying to delete rows from the 5th column of my dataset for cells containing "DIRECTSHIP"
The macro filters the range fine, but when if comes to deleting the row, the macro stops. Any ideas why?
Sub CanadaWarehouseFilter()
x = Range("E" & Rows.Count).End(xlUp).Row
If Application.WorksheetFunction.CountIf(Range("E22:E" & x), "DIRECTSHIP") > 0 Then
With Range("CanadaData")
.AutoFilter
.AutoFilter Field:=5, Criteria1:="DIRECTSHIP"
.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRows.Delete
End With
End If
Range("A2:C2").Select
End Sub