ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ShowAllData error (https://www.excelbanter.com/excel-programming/419827-showalldata-error.html)

BeSmart

ShowAllData error
 
Hi All
(Excel 2003)

I'm using Advance filter on a week of data in
sheets("Week1").Range("A19:H148"), based on criteria in cells E17:E18 (E17 =
Blank, E18 = =E20<0).

At the end my macro I must "ShowAllData".

Sometimes there is no data to filter for a week and I get an error:
I still need to show the worksheet even though no weeks of data where found.

Error message:
"ShowAllData method of Worksheet class failed"

I tried including: Application.DisplayAlerts = False
but the error message still appears & stops the macro.

I also tried including the following - but still no joy

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

Can anyone tell me what code I need to do two things:

- Don't show the error message or stop the macro when ShowAllData fails,
BUT
- type the text "NO NEW ACTIVITY" in cell D20 on the current worksheet
before continuing with the macro

--
Thank for your help
BeSmart


[email protected]

ShowAllData error
 
Hi

On error resume next
'your code
On error goto 0

is pretty standard to do this. Use it carefully, as it will supress
all errors (but not halt code execution) in between the on error
lines, so that if something else is wrong you may not spot it.

regards
Paul

On Nov 11, 8:16*am, BeSmart wrote:
Hi All
(Excel 2003)

I'm using Advance filter on a week of data in
sheets("Week1").Range("A19:H148"), based on criteria in cells E17:E18 (E17 =
Blank, E18 = =E20<0).

At the end my macro I must "ShowAllData".

Sometimes there is no data to filter for a week and I get an error:
I still need to show the worksheet even though no weeks of data where found.

Error message:
"ShowAllData method of Worksheet class failed"

I tried including: * *Application.DisplayAlerts = False
but the error message still appears & stops the macro.

I also tried including the following - but still no joy

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

Can anyone tell me what code I need to do two things:

- Don't show the error message or stop the macro when ShowAllData fails,
BUT
- type the text "NO NEW ACTIVITY" in cell D20 on the current worksheet
before continuing with the macro

--
Thank for your help
BeSmart




All times are GMT +1. The time now is 06:30 AM.

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