I am using a While…Wend loop of VBA.
Dim count as Integer
While True
count=count+1
If count = 10 Then
''What should be the statement to break the While...Wend loop?
''Break or Exit While not working
EndIf
Wend
I don’t want to use condition like `While count<=10…Wend
A
While/Wendloop can only be exited prematurely with aGOTOor by exiting from an outer block (Exit sub/functionor another exitable loop)Change to a
Doloop instead:Or for looping a set number of times:
(
Exit Forcan be used above to exit prematurely)