ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro / Autofilter / Show All Data (https://www.excelbanter.com/excel-discussion-misc-queries/256467-macro-autofilter-show-all-data.html)

cousinexcel

Macro / Autofilter / Show All Data
 
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

מיכאל (מיקי) אבידן

Macro / Autofilter / Show All Data
 
The easiest way will be by adding:
On Error resume Next
as the first command of the macro.
Micky


"CousinExcel" wrote:

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


מיכאל (מיקי) אבידן

Macro / Autofilter / Show All Data
 
As On error may cause some other "problems" - try this:
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
Micky


"מיכאל (מיקי) אבידן" wrote:

The easiest way will be by adding:
On Error resume Next
as the first command of the macro.
Micky


"CousinExcel" wrote:

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


Dave Peterson

Macro / Autofilter / 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

CousinExcel wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 08:29 AM.

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