Macro - filter - show all data

E

Eva

Hi
I have the spreadsheet with the macro that does number of things, but I am
not using it - only somebody else. The problem is that this person uses it
then from time to time uses a filter and if data are filtered the macro
crashes. I tried use "show all data" in the macro, but it crashes when there
is not filter used.
Is there a way to change the macro so if there is a filter used then
unfilter it, but if not do not change anything?

I am still on the learning curve with the VBA.
 
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
 
E

Eva

Works like a charm!
Thank you very much

--
Greatly appreciated
Eva


Dave Peterson said:
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

Top