Bonjour à tous ,
Je veux créer un tableau , qui contient les numéros des dossiers ( à chaque fois on ajoute un nouveau dossier ) , chaque dossier est associé à des éléments, alors ces éléments doivent étre rempli par " ✓ " si l'élément existe dans le dossier, sinon " " , alors je dois réaliser un formulaire qui contient des checkbox pour valider les éléments ( cocher l'élément s'il existe sinn on fai rien) , alors j'ai pas arrivé à relier les checkbox avec les cellules ainsi d'incrémenter dans le cas d'ajout d'un nouveau dossier.
Aidez moi SVP *
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
89
90
91
92
93
94
95
96
97
Option Explicit
Dim Ws As Worksheet
 
Private Sub CheckBox1_Click()
 
End Sub
 
Private Sub CommandButton1_Click() ' Bouton Ajouter
Dim no_ligne As Integer
 
'no_ligne = N° de ligne de la dernière cellule non vide de la colonne +1
            no_ligne = Range("A65536").End(xlUp).Row + 1
Cells(no_ligne, 1).Value = ComboBox1
Cells(no_ligne, 2).Value = CheckBox1
Cells(no_ligne, 3).Value = CheckBox2
Cells(no_ligne, 4).Value = CheckBox3
Cells(no_ligne, 5).Value = CheckBox4
 
End Sub
 
Private Sub CommandButton2_Click()  'Bouton Modifier un dossier
'Pour le bouton Modifier
 Dim Ligne As Long
 Dim I As Integer
  If MsgBox("Confirmez-vous la modification de ce dossier?", vbYesNo, "Demande de confirmation de modification") = vbYes Then
 If Me.ComboBox1.ListIndex = -1 Then Exit Sub
 Ligne = Me.ComboBox1.ListIndex + 2
Else
 For I = 1 To 7
 'If Me.Controls("TextBox" & I).Visible = True Then
' Ws.Cells(Ligne, I + 2) = Me.Controls("TextBox" & I)
 Cells(Ligne, 2).Value = CheckBox1
 Cells(Ligne, 3).Value = CheckBox2
 Cells(Ligne, 4).Value = CheckBox3
 Cells(Ligne, 5).Value = CheckBox4
 
 'End If
 Next I
End If
 
End Sub
 
Private Sub Label1_Click()
 
End Sub
 
Private Sub UserForm_Initialize()
   Sheets("Feuil7").Select
    With Sheets("Feuil7")
     Dim I As Integer
    For I = 2 To .Range("B65000").End(xlUp).Row
     If .Cells(I, 2) <> .Cells(I - 1, 2) Then
      If CheckBox1.Value Then
         Range("B2").Value = "*"
        Else
         Range("B2").Value = " "
       End If
     End If
    Next
 
    For I = 2 To .Range("C65000").End(xlUp).Row
     If .Cells(I, 3) <> .Cells(I - 1, 3) Then
      If CheckBox2.Value Then
         Range("C2").Value = "*"
        Else
         Range("C2").Value = " "
        End If
     End If
    Next
 
    For I = 2 To .Range("D65000").End(xlUp).Row
     If .Cells(I, 4) <> .Cells(I - 1, 4) Then
     If CheckBox2.Value Then
         Range("D2").Value = "*"
        Else
          Range("D2").Value = " "
    End If
     End If
    Next
  For I = 2 To .Range("E65000").End(xlUp).Row
     If .Cells(I, 5) <> .Cells(I - 1, 5) Then
     If CheckBox2.Value Then
         Range("E2").Value = "*"
        Else
          Range("E2").Value = " "
    End If
     End If
    Next
 
End With
Dim tablo, derligne As Integer
  With Worksheets("Feuil7")
    derligne = .Range("A65536").End(xlUp).Row
    tablo = Range(" A2:A" & derligne)
    ComboBox1.List = tablo
End With
End Sub