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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| Option Explicit
Dim tabl() As String
Dim ligne As Integer
Private Sub CheckBox1_Change()
Dim i As Integer
Dim variable As String
Range("X" & ligne).Clear
If CheckBox1.Value = True Then
tabl(1) = "2339, "
Else
tabl(1) = ""
End If
For i = 1 To 1000
variable = variable & tabl(i)
Next
Range("X" & ligne).Value = variable
End Sub
Private Sub CheckBox2_Change()
Dim i As Integer
Dim variable As String
Range("X" & ligne).Clear
If CheckBox2.Value = True Then
tabl(2) = "2340, "
Else
tabl(2) = ""
End If
For i = 1 To 1000
variable = variable & tabl(i)
Next
Range("X" & ligne).Value = variable
End Sub
Private Sub passeralaligne_Click()
' incrémente la ligne
ligne = ligne + 1
' vide le tableau
ReDim tabl(1000) As String
' vide l'ensemble des CheckBox
Dim nouveau As Control
For Each nouveau In Controls
Select Case TypeName(nouveau)
Case "CheckBox":
nouveau.Value = False
End Select
Next
End Sub
Private Sub sortie_Click()
' ferme le formulaire
Unload UserForm1
End Sub
Private Sub UserForm_Initialize()
Dim i As Integer
' Initialise le tableau et la première ligne
ReDim tabl(1000) As String
ligne = 2
' vide la colonne X
For i = ligne To Range("X65536").End(xlUp).Row
Range("x" & i).Clear
Next
End Sub |
Partager