Bonjour,

Je vais aller droit au but.

J'ai un UserForm à 2 pages. Sur le premier il y a plusieurs ComboBox qui me servent à localiser une cellule à modifier selon la valeur d'entrée de la ligne et de la colonne.

Mais il y a également une TextBox.

Sur la deuxième page il y a 32 Checkboxs.

L'objectif : Afficher le label des checkboxs cochées, dans la textbox.

Mon problème : Mon code me renvoit bien le nom des checkboxs dans ma textbox. Mais ils ne correspondent pas à ceux de checkbox cochées.

Ex : je coche la 1,2,11,15. Mon code me renvoit le bon nombre de checkbox mais le nom de la 1,2,3,4.

Mon Code :

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
 Option Explicit
Dim ln, col
Private Sub CommandButton_accepter_Click()
Cells(ln, col) = TextBox_Intit.Value
End Sub
Private Sub CommandButton_annuler_Click()
Unload Me
UserForm4.Show
End Sub
Private Sub CommandButton_quitter_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim Ctrl As Control
Dim j As Integer
j = 1
For Each Ctrl In UserForm4.Controls
    If TypeName(Ctrl) = "CheckBox" Then
        If Ctrl.Value = True Then
        TextBox_Intit.Value = TextBox_Intit.Value & Me.Controls("CheckBox" & Active.CheckBox.Name).Caption & "  "
        j = j + 1
        End If
    End If
Next Ctrl
Me.MultiPage1.Value = Me.MultiPage1.Value - 1
End Sub
Private Sub MultiPage1_Change()
End Sub
 
Private Sub UserForm_Initialize()
ComboBox_prepa.List = Application.Transpose(Range("C1:E1"))
ComboBox_version.List = Range("A2:A43").Value
End Sub
Private Sub ComboBox_prepa_Change()
    Call Saisies
End Sub
Private Sub ComboBox_version_Change()
    Call Saisies
End Sub
Sub Saisies()
    If ComboBox_prepa.ListIndex > -1 And ComboBox_version.ListIndex > -1 Then
        ln = 2 + ComboBox_version.ListIndex
        col = 3 + ComboBox_prepa.ListIndex
        TextBox_Cell = "Ln : " & ln & " , " & "Col : " & col
    End If
End Sub
Merci pour votre aide,
Cdlt