for i=1 to a if a<>1 then '这里是你的循环的代码 end ifnext i
if a=1 then exit for在for语句下一行添上这个语句
Sub ab()a = 1x = 0For i = 1 To a x = x + 1NextMsgBox xEnd Sub这不是当a=1时循环代码还不是在运行吗?此时x=1
For i=0 to a