VBA基础三:循环(DO...LOOP,)

Sub 基本示例()
Dim a%
a = -20
Do
a = a + 1
If a > 10 Then
MsgBox a & "终于大于10"
Exit Do
End If
Loop
End Sub

 

Sub 基本示例()
Dim rs%
rs = 1
Do
rs = rs + 1
If rs > 10 Then
Exit Sub
Else
If Cells(rs, 2) >= 90 Then Cells(rs, 3) = "√"
End If
Loop
End Sub

posted @ 2020-07-12 14:58  袁氏家谱网  阅读(11)  评论(1编辑  收藏