Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Error Handler not handling error...

I have code that loops through a workbook, copies the
contents of each sheet and pastes it to another workbook.

For each sheet I have this line:
ActiveSheet.ShowAllData

Most of the sheets are not filtered, so at this line the
code jumps into the error handler, where "Resume Next" is
waiting to push it back up into the loop.

The problem is this:
On the eighth sheet without filters, I get a debug error
on the ShowAllData line - it's like the errors are
stacking up. Can someone tell me what's happening, and
how to avoid this problem?

Thanks in advance.
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Error Handler not handling error...

Maybe this will solve your immediate problem:

Option Explicit
Sub testme()

Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
With wks
If .AutoFilterMode Then
If .FilterMode Then
.ShowAllData
End If
End If
End With
Next wks
End Sub

I'm not sure what's causing your other error, though.

Daniel Bonallack wrote:

I have code that loops through a workbook, copies the
contents of each sheet and pastes it to another workbook.

For each sheet I have this line:
ActiveSheet.ShowAllData

Most of the sheets are not filtered, so at this line the
code jumps into the error handler, where "Resume Next" is
waiting to push it back up into the loop.

The problem is this:
On the eighth sheet without filters, I get a debug error
on the ShowAllData line - it's like the errors are
stacking up. Can someone tell me what's happening, and
how to avoid this problem?

Thanks in advance.
Daniel


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Error Handler not handling error...

I tried to reproduce this and the code works OK.

It is more likely that you have a different error occurring with sheet
8 which is being trapped (been there, done that). Comment out the On
Error .. line to see the error message.

Regards
BrianB
===========================================


"Daniel Bonallack" wrote in message ...
I have code that loops through a workbook, copies the
contents of each sheet and pastes it to another workbook.

For each sheet I have this line:
ActiveSheet.ShowAllData

Most of the sheets are not filtered, so at this line the
code jumps into the error handler, where "Resume Next" is
waiting to push it back up into the loop.

The problem is this:
On the eighth sheet without filters, I get a debug error
on the ShowAllData line - it's like the errors are
stacking up. Can someone tell me what's happening, and
how to avoid this problem?

Thanks in advance.
Daniel

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error handler linto Excel Discussion (Misc queries) 1 February 11th 10 12:17 PM
Worksheet_change event handler error gen Excel Discussion (Misc queries) 0 January 18th 08 04:55 AM
Error Handler Question Jenny B. Excel Discussion (Misc queries) 4 January 9th 08 05:16 PM
Error Handler sharad Excel Discussion (Misc queries) 1 September 17th 07 06:38 PM
Error Handler Not Working Bill Excel Discussion (Misc queries) 0 August 25th 05 07:13 PM


All times are GMT +1. The time now is 10:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"