Private Sub CommandButton1_Click()
'dim R as range
'envoi toutes les références dans le tableau
Set r = Sheets("TDB").Range("tblbd").ListObject.ListRows.Add.Range
r.Cells(1).Value = Me.TextBox1.Value
r.Cells(1).Value = Me.TextBox2.Value
r.Cells(1).Value = Me.TextBox3.Value
Sheets("TDB").Activate
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim x&
Application.ScreenUpdating = True
With ListBox1
If ListBox1.ListIndex = -1 Then MsgBox ("Veuillez effectuer un choix d'article préalable !!!"): Exit Sub
If MsgBox("Voulez vous supprimer l'article sélectionné ?", vbYesNo) = vbYes Then
x = .List(.ListIndex, 3)
[Tab_6].Rows(x).EntireRow.Delete
End If
End With
MsgBox ("Suppression de la ligne effectuée !!!")
reliste
End Sub
Private Sub ListBox1_Click()
Dim tblBD()
With ListBox1
TextBox1 = .List(.ListIndex, 0)
TextBox2 = .List(.ListIndex, 1)
TextBox3 = .List(.ListIndex, 2)
End With
End Sub
Private Sub UserForm_Initialize()
reliste
End Sub
Sub reliste()
Dim tblBD()
tblBD = [Tab_6].Resize(, 4).Value: For i = 1 To UBound(tblBD): tblBD(i, 4) = i: Next
Me.ListBox1.List = tblBD
Me.ListBox1.ColumnCount = 4
Me.ListBox1.ColumnWidths = "40;50;50"
End Sub