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: 4
Default Error Handling with Nested Loops

I've got a couple of nested loops. The inner loop does a 'find' on one
sheet. Based on the found cell, it loads some values into variables that
are used on another page. The problem is with errors. The 'find' item may
occasionally not exist. If this is the case, I need for the loop to
continue with the next iteration. I've tried several approaches to fix this
and still come up short. Any ideas appreciated, code posted below:

(Some code to determine intNumTreaties)

For Counter = 1 To intNumTreaty

Sheets("FY Prem").Select
Range("B3").Select
Range(Selection, Selection.End(xlToRight)).Select
intNoCols = Selection.Columns.Count


For Counts = 1 To intNoCols

Sheets("FY Prem").Select
Range("A3").Select
strCurDate = ActiveCell.Offset(0, Counts).Value
strCurTreaty = ActiveCell.Offset(Counter, 0).Value
strCurGroup = strCurDate & strCurTreaty


Sheets("Acct Summary Pull").Select

Columns("A:A").Select
Selection.Find(what:=strCurGroup).Activate

(Error can happen here, if so need to move to next Counts at
this point)

curFYPrem = ActiveCell.Offset(0, 4).Value
curRnPrem = ActiveCell.Offset(0, 5).Value
curFYComm = ActiveCell.Offset(0, 6).Value
curRnComm = ActiveCell.Offset(0, 7).Value

(Some code here to work with the variables on other sheets)

Next Counts

Next Counter

End Sub


 
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
Help with nested for loops [email protected] Excel Discussion (Misc queries) 5 May 2nd 07 05:30 PM
Help with nested for loops [email protected] Excel Worksheet Functions 5 May 2nd 07 05:30 PM
Help on nested loops Jan Lukszo Excel Programming 1 July 29th 04 08:41 AM
Nested loops?? CG Rosén Excel Programming 1 June 22nd 04 08:07 PM
Error Handling and For-Next Loops SuperJas Excel Programming 2 May 28th 04 07:41 AM


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

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"