ShowAllData error

B

BeSmart

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
 
P

paul.robinson

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
 

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