vba中for n=1 to 20 next当处于某条件下终止next该怎么写

if X then exit forend if好吧
2025-03-23 16:36:48
推荐回答(1个)
回答(1):

退出整个循环用 exit for
for n=1 to 20
.....

if X then
exit for
end if
.....

next

如果想结束本次循环可以用goto

for n=1 to 20
.....

GoTo e
.....
.....
e:
next