I have recently use a Exit For within a For Next Loop to exit the loop later the procedure returns to the same For Next Loop. I noticed the control does not reset. Is this what is supposed to happen?

Recommended Answers

All 2 Replies

Well without seeing your code it is hard to tell, but generally an Exit For is used to speed up a procedure by exiting the for loop as soon as some condition is met...

pseudo code...

For LoopCounter = SomeStartValue To SomeEndValue Step SomePositiveOrNegativeValue 'defalut is + 1
  If SomeValue = SomeCondition Then Exit For
Next LoopCounter

Good Luck

Hi,

Not sure... but if you have decalred the variables as "Static", then the variables may not reset.... Static Variables retain their values between procedure calls..
just "Dim" the variables..
Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.