麻辣家族討論版版's Archiver

johnny1680 發表於 2021-7-20 16:04

For Next迴圈

[attach]33698[/attach]
[attach]33699[/attach]

初涉VBA

當A1填入10
希望B欄到E欄的結果 : 如附件
請問程式碼如何寫?
謝謝各位!

ML089 發表於 2021-7-20 16:28

Sub 加減數()
    For i = 1 To [a1]
        Cells(i, "B") = i
        Cells(i, "C") = [a1] + 1 - i
        Cells(i, "D") = i - 1
        Cells(i, "E") = [a1] - i
    Next
End Sub

作業要自己寫才會進步

johnny1680 發表於 2021-7-20 16:39

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=116057&ptid=23265]2#[/url] [i]ML089[/i] [/b]
你誤會了,這不是作業啦 :lol
我有上G大神查閱資料
但被For I=1 To 10 和  For I=1 To 10 Step -1 或+1
搞昏頭了~~~
謝謝你的幫忙!

johnny1680 發表於 2021-10-7 17:18

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=116057&ptid=23265]2#[/url] [i]ML089[/i] [/b]
   [url]http://forum.twbts.com/thread-23400-1-1.html[/url]   
[b]請您指導。謝謝您!

不好意思,因為無權發"短消息",所以以"回復"邀請您,尚請見諒。謝謝您!
[/b]

頁: [1]

麻辣家族討論版版為 麻辣學園 網站成員  由 昱得資訊工作室 © Since 1993 所提供