Bonjour à tous,
voila, j'ai une listbox sur ma feuil1 dont les données sont mise à jour automatiquement.
Est il possible de trier par ordre alpha ces données ?
Voici le code utilisé our l'instant :
Sub ListModif()
Dim Dif As String
Dim Prise As String
Dim cel As Variant
Dim dercel As String
dercel = Range("A65536").End(xlUp).Row
'vide listbox
Feuil1.Lb1.Clear
Range("A2:A" & dercel).Select
For Each cel In Selection
If cel.Interior.ColorIndex = 6 Then
'dificulté
If Cells(cel.Row, 6).Font.ColorIndex = 6 Then Dif = "Jaune"
If Cells(cel.Row, 6).Font.ColorIndex = 4 Then Dif = "Vert"
If Cells(cel.Row, 6).Font.ColorIndex = 5 Then Dif = "Bleu"
If Cells(cel.Row, 6).Font.ColorIndex = 3 Then Dif = "Rouge"
If Cells(cel.Row, 6).Font.ColorIndex = 1 Then Dif = "Noir"
If Cells(cel.Row, 6).Font.ColorIndex = 2 Then Dif = "Blanc"
'couleur de prises
If Cells(cel.Row, 7).Font.ColorIndex = 6 Then Prise = "Jaunes"
If Cells(cel.Row, 7).Font.ColorIndex = 4 Then Prise = "Vertes"
If Cells(cel.Row, 7).Font.ColorIndex = 5 Then Prise = "Bleues"
If Cells(cel.Row, 7).Font.ColorIndex = 7 Then Prise = "Roses"
If Cells(cel.Row, 7).Font.ColorIndex = 3 Then Prise = "Rouges"
If Cells(cel.Row, 7).Font.ColorIndex = 48 Then Prise = "Grises"
'remplie la listbox
Feuil1.Lb1.AddItem "Secteur " & Range("E" & cel.Row).Value & " - Bloc " & Dif & _
" - Prises " & Prise
End If
Next cel
End Sub
Voila !