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
| Private Sub CommandButton1_Click()
Dim element_select As Boolean
Dim nb_element, i As Integer
Dim dest As Range
element_select = False
nb_element = ListBox2.ListCount
With Worksheets("ARCHIVE CONGES")
For i = 0 To nb_element - 1
If ListBox2.Selected(i) = True Then
element_select = True
Set dest = IIf(.Range("A5").Value = "", .Range("A5"), .Cells(Application.Rows.Count, 1).End(xlUp).Offset(1, 0))
dest.Value = ListBox1.List(i, 0)
dest.Offset(0, 3) = ListBox2.List(i, 2)
dest.Offset(0, 4) = ListBox2.List(i, 3)
dest.Offset(0, 5) = ListBox2.List(i, 4)
End If
Next
If element_select = False Then
MsgBox "vous n'avez rien selectionné"
End If
End With
End Sub |
Partager