------

[ AD ] Port Monitor ( Try to use a Best WebSite Monitoring Tool )

------

직접 작성하기 힘드신 분은 첨부 파일을 받으세요..

<실행화면>

 

<실행소스>

Private Sub CommandButton1_Click()
Dim rotto(6) As Integer
Dim n As Integer
'-----------
For k = 1 To 12 '로또번호 10번 수행
For i = 1 To 6 Step 1
Cells(k, i) = ""
Cells(k, i).HorizontalAlignment = xlCenter
Next i
Next k
'----------
For i = 1 To 6 Step 1
Cells(1, i).Value = "[ " & i & " ]"
Cells(1, i).Interior.ColorIndex = 6
Next i

'---------
For k = 1 To 10 '로또번호 10번 수행
For i = 1 To 6 Step 1
If rotto(i) = 0 Then
Do
n = Int(Rnd() * 45 + 1)
Loop Until n <> rotto(1) And n <> _
rotto(2) And n <> rotto(3) And n <> _
rotto(4) And n <> rotto(5) And n <> rotto(6)
rotto(i) = n
End If
If (k < 6) Then
Cells(k + 1, i) = rotto(i)
Else
Cells(k + 2, i) = rotto(i)
End If
Next i
For i = 1 To 6
rotto(i) = 0
Next
Next k

End Sub

+ Recent posts