Private Sub complete_ar_Click()
Dim iListCount As Integer, iColCount As Integer
Dim iRow As Integer
Dim rStartCell As Range
'Set a range variable to the first cell to recieve our data
'Using "End(xlUp).Offset(1, 0)" _
will give us the cell below the last entry
'Loop as many times (less one) as there are entries in our list.
'We must start from zero to use this in the Selected Property.
For iListCount = 0 To ListBox2.ListCount - 1
If ListBox2.Selected(iListCount) = True Then 'User has selected
iRow = ListBox2.ListIndex + 1
' Ici test valeur > 50
If Range("plageprogress").Cells(iRow, 6) > 50 Then
Set rStartCell = SPOTCLASSIFIED.Range("A65536").End(xlUp).Offset(1, 0)
Else
Set rStartCell = SPOTCANCEL.Range("A65536").End(xlUp).Offset(1, 0)
End If
ListBox2.Selected(iListCount) = False
'Now loop as many times as there are columns in MyRange
For iColCount = 0 To Range("plageprogress").Columns.Count - 1
'place the selected data into the table, starting from _
range Ax And moving across As many columns As there are _
In the range MyRange.
rStartCell.Cells(1, iColCount + 1).Value = ListBox2.List(iListCount, iColCount)
Next iColCount
' Et là la date et l'heure en fonction du format e la colonne de la feuille
rStartCell.Cells(1, iColCount).Value = Now
Range("plageprogress").Rows(iRow).Delete
End If
Next iListCount
Set rStartCell = Nothing
End Sub