[VBA ] 迴圈問題

看板Visual_Basic作者 (信箱爆炸..XD)時間16年前 (2008/01/23 17:16), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/4 (看更多)
希望能夠根據call函數的次數產生想要的值 依序為1,2,3,4,5 2,3,4,5,6 及前5次產生1~5的值,6到10次產生2~6的數值 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Private Sub Form_Load() for t=1 to 10 call d(t) next t End Sub Function d(t) as integer d=???? end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Function該怎麼寫d才可以產生我想要的值,希望只用一個function就解決。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.17.179

01/23 20:21, , 1F
if t<=5 then d=t else d=t-4 end if
01/23 20:21, 1F
文章代碼(AID): #17bmNaeK (Visual_Basic)
文章代碼(AID): #17bmNaeK (Visual_Basic)