hello Gang,
I have some code that filters a list of data, then highlights the data and selects the visible cells only. If there are no lines that fit the data, then I get an error message...
This works fine to get rid of the filter and carry on with the code. However, I have the above type of code applied to 5 areas of the page (defined by x1 & x2). If I put an error handler (similar to 'inlab' above) at the end of each section, it only works for the first error. If I just use one error handler and put it at the end of the code, it just goes to end sub.
I'm sure there is a way to do this? The error handler can be just the one or I can have 6 of them, which ever works.
I hope I've explained this OK. Looking forward to some help as always.
Cheers,
I have some code that filters a list of data, then highlights the data and selects the visible cells only. If there are no lines that fit the data, then I get an error message...
Code:
On Error GoTo lnlab
Rows(x1 - 1).Select
Selection.AutoFilter
Selection.AutoFilter Field:=24, Criteria1:="<>"
Rows(x1 & ":" & x2).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
lnlab:
Selection.AutoFilter Field:=24
Selection.AutoFilter
This works fine to get rid of the filter and carry on with the code. However, I have the above type of code applied to 5 areas of the page (defined by x1 & x2). If I put an error handler (similar to 'inlab' above) at the end of each section, it only works for the first error. If I just use one error handler and put it at the end of the code, it just goes to end sub.
I'm sure there is a way to do this? The error handler can be just the one or I can have 6 of them, which ever works.
I hope I've explained this OK. Looking forward to some help as always.
Cheers,