Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Breaking out of a DO loop in Excel VBA
I have the following code:
Do Until [ ... ] repName = wrksheet.Cells(currentInputRow, "A") 'does user want to process commissions for this user? If mainForm.repsNames_frame.allOrSome_frame.someReps_ rb.Value = True Then 'if this button is checked, user only wants some reps If isDesiredRep(repName) = False Then '[ CODE NEEDS TO GO HERE TO GO TO NEXT ITERATION IN DO-UNTIL LOOP ] End If Else 'all reps are desired; continue processing regardless of whom it is End If Loop Please see the point where I commented " [ CODE NEEDS TO GO HERE ] "... How do I do some sort of continue or break or something so that if execution hits that line, it will go to the next iteration in the DO-UNTIL loop? Thanks, Eliezer |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Breaking out of a DO loop in Excel VBA
You probably need to redesign you if then structure to facilitate this, but
Do Until [ ... ] repName = wrksheet.Cells(currentInputRow, "A") 'does user want to process commissions for this user? If mainForm.repsNames_frame.allOrSome_frame.someReps_ rb.Value = True Then 'if this button is checked, user only wants some reps If isDesiredRep(repName) = False Then '[ CODE NEEDS TO GO HERE TO GO TO NEXT goto Label1 End If Else 'all reps are desired; continue processing regardless of whom it is End If Label1: ' code that sets the next iteration if necessary Loop "Eliezer" wrote in message ... I have the following code: Do Until [ ... ] repName = wrksheet.Cells(currentInputRow, "A") 'does user want to process commissions for this user? If mainForm.repsNames_frame.allOrSome_frame.someReps_ rb.Value = True Then 'if this button is checked, user only wants some reps If isDesiredRep(repName) = False Then '[ CODE NEEDS TO GO HERE TO GO TO NEXT ITERATION IN DO-UNTIL LOOP ] End If Else 'all reps are desired; continue processing regardless of whom it is End If Loop Please see the point where I commented " [ CODE NEEDS TO GO HERE ] "... How do I do some sort of continue or break or something so that if execution hits that line, it will go to the next iteration in the DO-UNTIL loop? Thanks, Eliezer |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 07 breaking links | Links and Linking in Excel | |||
Breaking out of a loop in Excel 2007? | Excel Discussion (Misc queries) | |||
Breaking down an excel formula | Excel Worksheet Functions | |||
breaking out of a loop | Excel Programming | |||
breaking a loop | Excel Programming |