1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| Sub initialiser()
Dim i As Integer, j As Integer
Range("B3:K11,L2,M3:V11").ClearContents
Columns("AA:AA").ClearContents
For i = 0 To 8
For j = 0 To 9
[B3].Offset(i, j) = 10 * i + j + 1
Next j
Next i
Range("M3:V11").Font.ColorIndex = 1
Range("M3:V11").Interior.ColorIndex = xlNone
End Sub
Sub tirer()
Dim i As Integer, j As Integer
If [L2].Value = 90 Then Exit Sub
Do
Randomize
i = Int(10 * Rnd): j = Int(11 * Rnd)
Loop While IsEmpty([B3].Offset(i, j))
[L2].Value = 1 + [L2].Value
With [M3].Offset(i, j)
.Value = [B3].Offset(i, j).Value
.Font.ColorIndex = 2
.Interior.ColorIndex = 3
End With
[AA200].End(xlUp).Offset(1, 0).Value = [B3].Offset(i, j).Value
[B3].Offset(i, j) = Empty
End Sub
Private Sub Noir_Click()
Dim c As Range
For Each c In Range("M3:V11")
If c.Font.ColorIndex = 2 And c.Interior.ColorIndex = 3 Then
c.Interior.ColorIndex = 1
End If
Next c
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("M3:V11")) Is Nothing Then
If Target.Cells.Count = 1 Then
Target.Font.ColorIndex = 2
Target.Interior.ColorIndex = 3
End If
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("M3:V11")) Is Nothing Then
Cancel = True
Target.Font.ColorIndex = 1
Target.Interior.ColorIndex = xlNone
End If
End Sub |
Partager