7. DO WHILE 迴圈(定義)
Do While 條件為真進入迴圈
敍述1
條件值變化
Loop
• 參考網站: http://www.excel-easy.com/vba/loop.html
8. DO WHILE 迴圈(用法)
• 功能:將儲存格A1到A10都填入20
Dim i As Integer
i = 1
Do While i < =10
Cells(i, 1).Value = 20
i = i + 1
Loop
• 參考網站: http://www.excel-easy.com/vba/loop.html
9. DO WHILE 迴圈(提早離開語法)
• Dim i As Integer
• i = 1
• Do While True
• Cells(i, 1).Value = i
• i = i + 1
• If i = 5 Then
• Exit Do '提早離開
• End If
• Loop
10. 迴圈(WHILE)
• Dim i As Integer
• i = 1
• While i < 10
• Cells(i, 1).Value = i
• i = i + 1
• Wend