ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Show All Data (https://www.excelbanter.com/excel-programming/392503-show-all-data.html)

B Baggins

Show All Data
 
I have some quite complex filters and am trying to make the spreadsheet more
user friendly.

I have included a button to restore the Show All Data using the VBA:

ActiveSheet.ShowAllData

This works, but only if there has been a filter applied. If the user clicks
the button again (without a filter being present) I get the following error
message - "Run Time error 1004 - ShowAllData method of Worksheet class
failed".

How can I stop this error message, or better still advise the user (MSGBOX?)
that all the data is currently being shown?

Thank you for your help.

Gary Keramidas

Show All Data
 
maybe something like this

If ActiveSheet.AutoFilterMode = True Then
ActiveSheet.ShowAllData
End If

--


Gary


"B Baggins" wrote in message
...
I have some quite complex filters and am trying to make the spreadsheet more
user friendly.

I have included a button to restore the Show All Data using the VBA:

ActiveSheet.ShowAllData

This works, but only if there has been a filter applied. If the user clicks
the button again (without a filter being present) I get the following error
message - "Run Time error 1004 - ShowAllData method of Worksheet class
failed".

How can I stop this error message, or better still advise the user (MSGBOX?)
that all the data is currently being shown?

Thank you for your help.




Tom Ogilvy

Show All Data
 
if activesheet.filtermode then
activesheet.showAlldata
End if

--
Regards,
Tom Ogilvy


"B Baggins" wrote:

I have some quite complex filters and am trying to make the spreadsheet more
user friendly.

I have included a button to restore the Show All Data using the VBA:

ActiveSheet.ShowAllData

This works, but only if there has been a filter applied. If the user clicks
the button again (without a filter being present) I get the following error
message - "Run Time error 1004 - ShowAllData method of Worksheet class
failed".

How can I stop this error message, or better still advise the user (MSGBOX?)
that all the data is currently being shown?

Thank you for your help.


Gary Keramidas

Show All Data
 
sorry, should have posted this

If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If


--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
maybe something like this

If ActiveSheet.AutoFilterMode = True Then
ActiveSheet.ShowAllData
End If

--


Gary


"B Baggins" wrote in message
...
I have some quite complex filters and am trying to make the spreadsheet more
user friendly.

I have included a button to restore the Show All Data using the VBA:

ActiveSheet.ShowAllData

This works, but only if there has been a filter applied. If the user clicks
the button again (without a filter being present) I get the following error
message - "Run Time error 1004 - ShowAllData method of Worksheet class
failed".

How can I stop this error message, or better still advise the user (MSGBOX?)
that all the data is currently being shown?

Thank you for your help.






Snake Plissken[_2_]

Show All Data
 
Sub Makro2()

If ActiveSheet.FilterMode = False Then
MsgBox "No filter !"
ElseIf ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
Else
MsgBox "unknown case"
End If


End Sub



B Baggins

Show All Data
 
Thanks everyone - works perfectly


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

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