1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Private Sub CommandButton1_Click()
Dim Ctrl As Control
Dim Colonne As Integer
Dim DerLigne As Integer
Dim i As Long
DerLigne = Sheets("Base").Range("A65000").End(xlUp).Row + 1
For Each Ctrl In UserForm1.Controls
Colonne = Val(Ctrl.Tag)
If Colonne = 11 Then
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then Sheets("Base").Cells(DerLigne, Colonne) = Sheets("Base").Cells(DerLigne, Colonne) & "-" & ListBox1.List(i)
Next
ElseIf Colonne = 12 Then
For i = 0 To ListBox2.ListCount - 1
If ListBox2.Selected(i) = True Then Sheets("Base").Cells(DerLigne, Colonne) = Sheets("Base").Cells(DerLigne, Colonne) & "-" & ListBox2.List(i)
Next
ElseIf Colonne > 0 Then
Sheets("Base").Cells(DerLigne, Colonne) = Ctrl
End If
Next
End Sub |
Partager