½Ð°Ý¦p¦ó¥ÎARRAY°µ¸ê®Æ¤ñ¹ï¡H
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-12-16 17:53 ½s¿è
¦^´_ 1# ¤p«L«È - Option Explicit
- Public Rng As Range, Rng1 As Range, Rng2 As Range
- Sub Restart()
- Sheets(1).Cells.Clear
- End Sub
- Sub Draw()
- Dim B As Integer, C As Integer, d As Integer
- With Sheet1
- L:
- B = Int(100 * Rnd() + 1)
- C = Application.CountIf(.Range("A:A"), B) '¤ñ¹ï¬O§_«´_
- If C = 1 Then GoTo L: '«°µ¶Ã¼Æ
- d = Application.CountA(.Range("A:A")) + 5
- .Cells(d, 1) = B
- .Cells(d, 1).Select
- Bingo (B)
- End With
- End Sub
- Sub Paper()
- Dim E As Range, B As Integer, i As Integer, ii As Integer
- Set Rng = [Sheet1!I1:M5] '³]©w¼Æ¦r°Ï°ì
- For Each E In Rng
- L:
- B = Int(100 * Rnd() + 1)
- C = Application.CountIf(Rng, B) '¤ñ¹ï¬O§_«´_
- If C = 1 Then GoTo L:
- E = B
- Next
- For i = 1 To 5 '³]©w¹ï¨¤½u¥Ñ¥ª¦Ü¥k°Ï°ì
- If i = 1 Then
- Set Rng1 = Rng.Cells(i, i)
- Else
- Set Rng1 = Union(Rng1, Rng.Cells(i, i))
- End If
- Next
- ii = 5
- For i = 1 To 5 '³]©w¹ï¨¤½u¥Ñ¥k¦Ü¥ª°Ï°ì
- If i = 1 Then
- Set Rng2 = Rng.Cells(i, ii)
- Else
- Set Rng2 = Union(Rng1, Rng.Cells(i, ii))
- End If
- ii = ii - 1
- Next
- End Sub
- Sub Bingo(No As Integer)
- Dim f As Range, d As Integer, C As Range, i As Integer, ii As Integer
- Set f = Rng.Find(No, LookIn:=xlValues, LOOKAT:=xlWhole) '´M§ä¼Æ¦r
- If f Is Nothing Then Exit Sub
- If Not f Is Nothing Then
- f.Font.ColorIndex = 3 '§ä¨ì¼Æ¦rµ¹¦rÅéÃC¦â
- f.Font.FontStyle = "²ÊÅé" '§ä¨ì¼Æ¦rµ¹¦r«¬¼Ë¦¡
- End If
- For i = 1 To Rng.Columns.Count
- d = 0
- For Each C In Rng.Columns(i).Cells
- If C.Font.ColorIndex = 3 Then d = d + 1
- Next
- If d = 5 Then Rng.Columns(i).Select: GoTo ok
- Next
- For i = 1 To Rng.Rows.Count 'Àˬd¾î¦C
- d = 0
- For Each C In Rng.Rows(i).Cells
- If C.Font.ColorIndex = 3 Then d = d + 1
- Next
- If d = 5 Then Rng.Rows(i).Select: GoTo ok
- Next
- d = 0
- For Each C In Rng1 'Àˬd¹ï¨¤½u
- If C.Font.ColorIndex = 3 Then d = d + 1
- Next
- If d = 5 Then Rng1.Select: GoTo ok
- d = 0
- For Each C In Rng2 'Àˬd¹ï¨¤½u
- If C.Font.ColorIndex = 3 Then d = d + 1
- Next
- If d = 5 Then Rng2.Select: GoTo ok
- Exit Sub
- ok:
- MsgBox "Bingo"
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|