Macro / Autofilter / Show All Data

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
 
D

Dave Peterson

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
 

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

Similar Threads


Top