Catch Error on Filter Sub

J

jfitzpat

I have a sub that clears the previous filters to show all rows. If no
filter is on then it halts with an error. How do I set an if stmt so this
clear does not run or how do I set error catching to the sub just goes to the
next step. I tried some basics that I found but they dont work so my syntax
might be wrong. I commented out the things I tried that did not work.

Sub ShowAllRows()
'
' ShowAllRows Macro
'
' If ActiveSheet.ShowAllData = False Then
ActiveSheet.ShowAllData
' On Error Resume Next
Range("J10").Select

End Sub
 
W

wayneL

jfitzpat said:
I have a sub that clears the previous filters to show all rows. If no
filter is on then it halts with an error. How do I set an if stmt so this
clear does not run or how do I set error catching to the sub just goes to the
next step. I tried some basics that I found but they dont work so my syntax
might be wrong. I commented out the things I tried that did not work.

'This works ...sort of

If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If

'I find if too muchdata is filtered out this crashes
'Actually even using the built in menu command crashes (hangs) excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top