Error msg for "ShowAll"?

  • Thread starter StargateFanFromWork
  • Start date
S

StargateFanFromWork

I have a button on a spreadsheet that accesses performs the "ShowAll"
function of:

ActiveSheet.ShowAllData

It works great unless all the data is present, of course. Rather than get
the 1004 error of:

"Run-time error '1004':

ShowAllData method of Worksheet class failed"

what can I add to the line of coding above, ActiveSheet.ShowAllData, to
alert the user that all the data is showing?

Thanks.
 
K

kkknie

Try:

On Error Resume Next
ActiveSheet.ShowAllData
If Err.Number <> 0 Then Msgbox "All data is being shown"
On Error Goto 0
 
S

StargateFanFromWork

kkknie > said:
Try:

On Error Resume Next
ActiveSheet.ShowAllData
If Err.Number <> 0 Then Msgbox "All data is being shown"
On Error Goto 0

K

Oh, thank you so much! This worked perfectly. I incorporated it into two
sheets.

Thanks!
 

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