ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro - filter - show all data (https://www.excelbanter.com/excel-worksheet-functions/256331-macro-filter-show-all-data.html)

Eva

Macro - filter - show all data
 
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.
--
Greatly appreciated
Eva

Dave Peterson

Macro - filter - show all data
 
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

Eva wrote:

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.
--
Greatly appreciated
Eva


--

Dave Peterson

Eva

Macro - filter - show all data
 
Works like a charm!
Thank you very much

--
Greatly appreciated
Eva


"Dave Peterson" wrote:

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

Eva wrote:

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.
--
Greatly appreciated
Eva


--

Dave Peterson
.



All times are GMT +1. The time now is 03:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com