Macro / Autofilter / Show All Data

  • Thread starter Thread starter CousinExcel
  • Start date Start date
C

CousinExcel

Hi,

I wrote in the macro
ActiveSheet.ShowAllData
but if no filtering is set, I get error message.
Is it possible to say something like
If 'filtered...'

Thanks and regards,

Cousin Excel
 
The easiest way will be by adding:
On Error resume Next
as the first command of the macro.
Micky
 
As On error may cause some other "problems" - try this:
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
Micky
 
If you want to remove the filter (and filter arrows):

With worksheets("Somesheetnamehere")
.autofiltermode = false
end with

If you want to just show the data, but keep the arrows:

With worksheets("Somesheetnamehere")
if .filtermode then
'some filter is applied
.showalldata
end if
end with
 
Back
Top