Catch Error on Filter Sub

  • Thread starter Thread starter jfitzpat
  • Start date Start date
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
 
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
 
Back
Top