[VBA ] Do while 迴圈跳不出來
各位好,魯妹是VB自學初心者
本週在複習Do while 時 發現寫出來的迴圈永不不止息阿阿阿阿
魯妹本來的預想是希望可以藉由do while檢查inputbox 的數值是否可以正確執行
若無法,則顯示msgbox提醒
所以就有了下列寫法,
i = InputBox("Start Value")
If i = "" Then End
Do While i <> ""
If i = intger Then Exit Do
Select Case InputBox("Start Value")
Case IsNumeric(i) = False: MsgBox "請數入數字": i = InputBox("Start
Value")
Case i <= 0: MsgBox "數值不得為負": i = InputBox("Start Value")
End Select
Loop
j = InputBox("End Value")
If j = "" Then End
Do While j <> ""
If j = intger Then Exit Do
Select Case InputBox("End Value")
Case IsNumeric(j) = False: MsgBox "請數入數字": j = InputBox("End Value")
Case j <= 0: MsgBox "數值不得為負": j = InputBox("End Value")
If i = j Then j = j + 1
End Select
Loop
還請好心的大大提點,到底是哪裡出了問題阿阿
魯妹先謝謝大家了m(_ _)m
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.40.23.201
※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1484972847.A.B0C.html
→
01/21 15:06, , 1F
01/21 15:06, 1F
→
01/21 15:08, , 2F
01/21 15:08, 2F
→
01/21 15:08, , 3F
01/21 15:08, 3F
推
01/23 05:34, , 4F
01/23 05:34, 4F
→
01/23 05:34, , 5F
01/23 05:34, 5F
→
01/23 05:36, , 6F
01/23 05:36, 6F
→
01/23 05:39, , 7F
01/23 05:39, 7F
→
01/23 05:40, , 8F
01/23 05:40, 8F
→
01/23 05:41, , 9F
01/23 05:41, 9F
→
01/23 05:45, , 10F
01/23 05:45, 10F
→
01/23 05:46, , 11F
01/23 05:46, 11F
→
01/23 05:48, , 12F
01/23 05:48, 12F
→
01/23 05:48, , 13F
01/23 05:48, 13F
推
01/23 05:52, , 14F
01/23 05:52, 14F
→
01/23 05:54, , 15F
01/23 05:54, 15F
→
01/23 05:54, , 16F
01/23 05:54, 16F
→
01/23 11:59, , 17F
01/23 11:59, 17F
→
01/23 14:07, , 18F
01/23 14:07, 18F
→
01/23 14:07, , 19F
01/23 14:07, 19F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章