Я использую цикл While... Wend из 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
Я не хочу использовать условие типа `While Count <= 10... Wend
A While/Wend
может выйти только преждевременно с помощью GOTO
или путем выхода из внешнего блока (Exit sub
/function
/another exitable loop
)
Перейдите в Do
loop intead;
Do While True
count = count + 1
If count = 10 Then
Exit Do
End If
Loop
(Или для циклического цикла с заданной переменной управляющего параметра)
for count = 1 to 10
msgbox count
next