VBA - trier variable tableau

reubeucope

XLDnaute Nouveau
bonjour au forum.

je souhaite trier une variable tableau. Voici sa déclaration :

Public ListeDoc (1 to 1000,2) as string

La première colonne contient tous les chemins de fichiers présents dans un dossier et dans ses sous-dossiers.

Comment trier les chemins par ordre alphabétique?

Merci d'avance.
 

Hervé

XLDnaute Barbatruc
Bonjour reubeucop, le forum

difficile de répondre sans document joint, enfin, ton code devrait ressembler à ceci :

Dim i As Integer, j As Integer
Dim temp1 As String, temp2 As String
   
For i = 1 To UBound(ListeDoc, 1)
   
For j = i To UBound(ListeDoc, 1)
       
If ListeDoc(i, 1) > ListeDoc(j, 1) Then
            temp1 = ListeDoc(i, 1)
            temp2 = ListeDoc(i, 2)
            ListeDoc(i, 1) = ListeDoc(j, 1)
            ListeDoc(i, 2) = ListeDoc(j, 2)
            ListeDoc(j, 1) = temp1
            ListeDoc(j, 2) = temp2
       
End If
   
Next j
Next i

surement à adapter.

salut
 

Discussions similaires

Réponses
9
Affichages
341

Statistiques des forums

Discussions
312 563
Messages
2 089 692
Membres
104 257
dernier inscrit
Stane78