Exporter listbox dans 2 tableaux suivant valeur

Bonjour,

J'ai besoin d'aide pour continuer un projet.

Je vous explique :

J'ai une listbox multi-colonne dans laquelle j'affiche des informations du type :

colonne 1 : Mr ou Mme

colonne 2 : Nom

colonne 3 : Prénom

Une fois la liste afficher, via un bouton je transfère les infos dans 2 tableaux.

Le truc que je souhaite ce serait que :

Tous les Mr (avec leurs nom et prénom) se retrouve dans le tableau commençant en A3

Toutes les Mme (avec leurs nom et prénom) se retrouve dans le tableau commençant en H3

ci-joint le code de mon bouton qui pour l'instant marche bien mais n'a pas la fonction tri Mr/Mme que je ne sais pas intégrer.

Private Sub CommandButton1_Click()
Sheets("Participants").Visible = True
 Sheets("Participants").Select
    Rows("3:400").Select
    Selection.Delete Shift:=xlUp
    Range("A3").Select
With Me.ListBox2
Worksheets("Participants").Range("a3").Resize(.ListCount, .ColumnCount) = .List
End With
 Range("H3").Select
With Me.ListBox2
Worksheets("Participants").Range("H3").Resize(.ListCount, .ColumnCount) = .List
End With
  Worksheets("Participants").Activate
  Unload Me
End Sub

Merci d'avance.

Bonjour,

Code ci-dessous

    '..................................................................................................................
    With Me.ListBox2
        Sheets("Participants").Range("A3").Resize(.ListCount, .ColumnCount) = .List
        With Sheets("Participants").Range("A3").Resize(.ListCount, .ColumnCount)
            .Sort Key1:=.Cells(1, 1), Order1:=xlDescending, Header:=xlNo
            Range(.Cells(Application.CountIf(.Columns(1), "Mr") + 1, 1), .Cells(.Rows.Count, .Columns.Count)).Delete (xlShiftUp)
        End With
        Sheets("Participants").Range("H3").Resize(.ListCount, .ColumnCount) = .List
        With Sheets("Participants").Range("H3").Resize(.ListCount, .ColumnCount)
            .Sort Key1:=.Cells(1, 1), Order1:=xlAscending, Header:=xlNo
            Range(.Cells(Application.CountIf(.Columns(1), "Mme") + 1, 1), .Cells(.Rows.Count, .Columns.Count)).Delete (xlShiftUp)
        End With
    End With
    '...................................................................................................................

Merci,

Parfait.

J'ai juste changer Cells(.Rows.Count, 2) en Cells(.Rows.Count, 3) sinon la colonne 3 (les prénoms) continuait sans tri.

Un grand merci.

Un petit oubli ...

Il vaut mieux mettre

.Cells(.Rows.Count, .Columns.Count))

J'ai corrigé dans mon post initial.

Ok, modif faite.

Merci.

Rechercher des sujets similaires à "exporter listbox tableaux suivant valeur"