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 57 58 59 60 61 62 63 64 65 66 67 68
|
Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1
Private Sub CommandButton1_Click()
End Sub
Private Sub CommandButton2_Click()
End Sub
Private Sub cb_calculer_Click()
verification
End Sub
Private Sub cb_placer_Click()
Dim ligne, colonne
Dim symbole, a
symbole = "x"
Dim n
n = 0
Do
ligne = Int(Rnd * 10 + 1)
colonne = Int(Rnd * 10 + 1)
If Cells(ligne, colonne).Value = "" Then
Cells(ligne, colonne).Value = "x"
n = n + 1
End If
Loop While n < 10
End Sub
Private Sub cb_vider_Click()
Dim i, j
'nettoyer
For i = 1 To 10
For j = 1 To 10
Cells(i, j).ClearContents
Next j
Next i
End Sub
Private Sub verification()
Dim l, c, l1, c1, n
For l = 1 To 10
For c = 1 To 10
If Cells(l, c).Value = "" Then
n = 0
For l1 = l - 1 To l + 1
For c1 = c - 1 To c + 1
If Cells(l1, c1).Value = "x" Then
n = n + 1
End If
Next c1
Next l1
If n <> 0 Then
Cells(l, c).Value = n
End If
End If
Next c
Next l
End Sub |
Partager