Originally Posted by
sajina
Doing Activesheet.showalldata fails if a filter criteria is not selected.
... which is why you have the "On Error Resume Next"
- If the data is filtered and criteria is selected, the criteria is removed so all rows are displayed.
- If there is no autofilter on, all data is already displayed.
- If the filter is on but no criteria is selected, all data is already displayed.
So to restate, the simplest solution is
[VBA]
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo ErrHandler
[/VBA]