Bonjour à vous
je continue mon autoformation sur les variables tableaux.
mon exercice d'aujourd'hui se porte sur l'enregistrement dans une variable tableau. lors de l'exécution du 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
Private Sub CommandButton1_Click()
Dim Ligne As Integer
Dim CompTextbox As Byte, compteur As Integer
Dim Tablo(), C()

With Worksheets(1)


Tablo = .Range("Tableau1").Value
    'If Not .ListObjects(1).DataBodyRange Is Nothing Then
    ReDim C(LBound(Tablo) To UBound(Tablo))
        For compteur = 0 To UBound(C)
            For CompTextbox = 1 To 4
                If Me("TextBox" & CompTextbox) <> "" Then
                    C(compteur, CompTextbox - 1) = Me("TextBox" & CompTextbox)
                End If
            Next
        Next
    'End If
.ListObjects(1).ListRows.Add
Ligne = .Cells(.Rows.Count, 1).End(xlUp).Row
.Cells(Ligne, CompTextbox) = C
End With

End Sub
la ligne est surlignée est je reçois le message qui est mentionné dans mon titre: l'indice n'appartient pas à la sélection.

j'ai besoin de votre aide . merci