2014年12月7日 星期日

12/5 excel VBA 亂數產生
VB excel 亂數程式碼
Private Sub CommandButton1_Click()
For i = 1 To 9
Cells(1, i) = i
Cells(1, i).Font.ColorIndex = 0
Next
For i = 1 To 9
j = 10 - i
myrandom = (Fix(Rnd() * j + 1))
Cells(3, 3) = myrandom
tem = Cells(1, j)
Cells(1, j) = Cells(1, myrandom)
Cells(1, myrandom) = tem
Next
End Sub


0 個意見:

張貼留言

訂閱 張貼留言 [Atom]

<< 首頁