Code to determine if data is filtered

  • Thread starter Thread starter excel
  • Start date Start date
E

excel

What code could I use to show all rows in the data filtering, IF data
filtering is on. I tried,
ActiveSheet.ShowAllData

but then it bombs if nothing is already filtered.
 
Several ways to check for filter, but to take yours to the next level
On Error Resume Next
ActiveSheet.ShowAllData
 
With activesheet
If .FilterMode Then
.ShowAllData
End If
end with

or just ignore the error:

on error resume next
ActiveSheet.ShowAllData
 
Back
Top