Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Excel 07 breaking links LisaK Links and Linking in Excel 11 January 6th 10 06:11 PM
Breaking out of a loop in Excel 2007? Don Excel Discussion (Misc queries) 0 April 30th 09 06:49 PM
Breaking down an excel formula [email protected] Excel Worksheet Functions 5 October 11th 07 07:50 PM
breaking out of a loop ChuckM[_2_] Excel Programming 1 December 16th 03 07:07 PM
breaking a loop Arkaad Excel Programming 2 September 23rd 03 01:28 PM


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

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"