Bonjour,
J'ai le code suivant et la ligne en rouge bloque ("Set lo =ws.ListObjects(1)". On m'indique "Erreur d'exécution '9'. L'indice n'appartient pas à la sélection".
Pourriez-vous m'aider ? Car je ne comprends pas le problème,
Merci
Private Sub CommandButton1_Click()
Dim ws As Worksheet, lo As ListObject, rCell As Range
Dim i As Integer, y As Integer
Dim x As Integer
If MsgBox("Do you confirm the entry?", vbYesNo, "Confirmation") = vbYes Then
Set ws = Worksheets("Base clients non Accor")
Set lo = ws.ListObjects(1)
With lo
'si le tableau n'est pas vide (nombre de lignes +1)
If .InsertRowRange Is Nothing Then
Set rCell = .HeaderRowRange.Cells(1).Offset(.ListRows.Count + 1)
Else
Set rCell = .InsertRowRange.Cells(1)
End If
End With
With rCell
.Value = TextBox1.Value
.Offset(, 3).Value = TextBox2.Value
.Offset(, 4).Value = TextBox3.Value
Etc.