LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Error Handle to Exit Loop on Blank Page

I have a loop which loops through sheets and cells via the SpecialCells
Method. If I come to a sheet which is blank I want the code to exit the loop
and proceed onto the next sheet. The error handling below does not do this.
What changes do I need to make?

For Each sht In ThisWorkbook.Worksheets
sht.Activate
On Error Resume Next ' Added in event that sheet does not have
formulas
For Each rng In sht.UsedRange.SpecialCells(xlCellTypeFormulas)
If Err.Number < 0 Then
Exit For
Else
rng.Select
End If

Thanks

EM
 
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
How to exit the loop? Eric Excel Programming 3 March 16th 08 05:00 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
exit for loop Daniel Excel Programming 2 January 3rd 08 07:36 PM
exit for next loop David Henderson Excel Programming 2 March 23rd 06 08:07 PM
exit from a loop? Kieran1028[_5_] Excel Programming 0 November 10th 04 02:55 PM


All times are GMT +1. The time now is 01:45 PM.

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

About Us

"It's about Microsoft Excel"