Trier par le nom

Bonjour

Je recherche un code VBA pour trier en fonction du nom qui se trouve toujours en

class="st4 st5"> xxxxx </text>

Je vous remercie d'avance

Max

4trier.xlsm (9.43 Ko)

Bonjour valmax, le forum,

Un essai.....

Principe:

en J3:

  • Je supprime </text>
  • J'extrais les caractères après >
 =DROITE(GAUCHE(B3;NBCAR(B3)-7);NBCAR(GAUCHE(B3;NBCAR(B3)-7))-TROUVE(">";GAUCHE(B3;NBCAR(B3)-7)))
  • Je tire la formule jusqu'à le dernière ligne
  • Je trie par odre alphabétique
  • Je supprime la colonne j

Cordialement,

Bonjour,

Autre proposition

12trier1.xlsm (15.68 Ko)

Re,

Une variante (inspiré par la proposition de thev, ) qui prend en compte les lignes vides pour le tri....

Sub test()
  Dim tablo(), tabloR(), k, i
  Dim dl As Long

   With Sheets("Feuil1")
      dl = .Range("B" & Rows.Count).End(xlUp).Row

  Application.ScreenUpdating = False
   tablo = Range("B3:B" & dl)
     k = 0
      For i = 1 To UBound(tablo, 1)
         ReDim Preserve tabloR(1 To 1, 1 To k + 1)
          If tablo(i, 1) = "" Then
              tabloR(1, k + 1) = "ZZZ"
          Else
            tabloR(1, k + 1) = Replace(Split(tablo(i, 1), ">")(1), "</text", "")
          End If
            k = k + 1
      Next i
       On Error Resume Next
          .Range("J" & Rows.Count).End(xlUp).Offset(2, 0).Resize(UBound(tabloR, 2), 1) = Application.Transpose(tabloR)
       Erase tabloR
          .Range("B3:J" & dl).Sort key1:=Range("J3")
          .Columns("J:J").Delete
    End With
   Application.ScreenUpdating = True
End Sub

Cordialement,

Bonjour, xorsankukai, thev

Je vous remercie c'est Nickel

Je vous souhaite une bonne journée

Max

Rechercher des sujets similaires à "trier nom"