ExcelใฎVBA(ใใฏใญ)ใงใDo๏ฝWhile๏ฝLoopๆใฎไฝฟใๆน (ๆกไปถๅผใชใฉ๏ผใซใคใใฆ็ดนไปใใพใใ
Exitๆใฏ
Exitๆใฏใๅฎ่กไธญใฎๅฆ็ใ้ไธญใงๆใใๆฉ่ฝใงใใ
ๆธๅผ
Exit ๆงๆๅ
่จ่ฟฐไพ | ่ชฌๆ |
---|---|
Exit Do | Do๏ฝWhileๆใ้ไธญใงๆใใ |
Exit For | Forๆใ้ไธญใงๆใใ |
Exit Function | Functionๆใ้ไธญใงๆใใ |
Exit Property | Propertyๆใ้ไธญใงๆใใ |
Exit Sub | Subๆใ้ไธญใงๆใใ |
ใตใณใใซใณใผใ
ใตใณใใซใใญใฐใฉใ ใฎใฝใผในใณใผใใงใใ
Sub test() i = 1 Do While i < 5 MsgBox i i = i + 1 If i = 2 Then MsgBox "้ไธญ็ตไบ" Exit Do End If Loop End Sub
ใกใใปใผใธใใใฏในใซใ1ใใ้ไธญ็ตไบใใจ่กจ็คบใใใฆใใใพใใ
iใ2ใซใชใฃใใจใใซใExitๆใงDo Whileใใๆใๅบใใพใใ
้ข้ฃใใผใธ
ใVBAๅ
ฅ้ใๅบ็คใใไฝๆฅญ่ชๅๅใฎๅฟ็จไพใพใง่งฃ่ชฌ
VBA๏ผใใฏใญ๏ผใงๆงใ
ใชๅฆ็ใ่ชๅๅใใๆนๆณใใตใณใใซใณใผใไปใใงๅ
ฅ้่
ๅใใซใพใจใใพใใใ
ใณใกใณใ