Hello,
My macro was working quite well, up until when it encounters trying to filter by criteria that doesn't exist.
As an example, the below would already be filtered by field 5, then I would want to apply an additional filter to field 8.
If the criteria "PA" doesn't exist, everything gets thrown out of whack.
Is there something I can do to somehow check if PA exists before trying to filter by field 8?
Thank you
My macro was working quite well, up until when it encounters trying to filter by criteria that doesn't exist.
As an example, the below would already be filtered by field 5, then I would want to apply an additional filter to field 8.
VBA Code:
With ws
.Rows(2).AutoFilter field:=5, Criteria1:=dlr
.Range(ws.Cells(1, 13), ws.Cells(1, 22)).Copy
End With
With ws
.Rows(2).AutoFilter field:=14
.Rows(2).AutoFilter field:=8, Criteria1:="PA"
.Range(ws.Cells(1, 13), ws.Cells(1, 22)).Copy
End With
Is there something I can do to somehow check if PA exists before trying to filter by field 8?
Thank you