Trier suivant lignes et colonnes

bonjour

j'ai un tableau comme ceci pour un jeu :

  A B C D E
A 2 6
B
C 5
D
E

le 6 signifie que A donne 6 à B

le 5 signifie que C donne 5 à A

voilà

maintenant, C change de nom et s'appelle François

du coup je vais trier les lignes automatiqument, suivant la première colonne,je sais faire

mais existerait-il un moyen que les colonnes se trient aussi du coup ?

j'imagine que dans un second temps je peux trier les colonnes

mais comment obtenir un moyen simple où, par un clic, les tris se font

en imaginant par exemple qu'à chaque tour les joueurs changent de nom disons

Vinz

Salut Vincent,

quelque chose comme ça ?
De plus, quand tu encodes un point, le total du joueur s'affiche dans la case orange correspondante

Private Sub Worksheet_Change(ByVal Target As Range)
'
Dim iRow%, iCol%
'
Application.EnableEvents = False
Application.ScreenUpdating = False
'
iRow = Range("A" & Rows.Count).End(xlUp).Row
iCol = Cells(1, 1).End(xlToRight).Column
If Not Intersect(Target, Union(Rows(1), Columns(1))) Is Nothing Then _
    If Target.Address <> "$A$1" And Cells(1, 1000) <> "" Then _
        IIf(Target.Row = 1, Columns(1), Rows(1)).Find(what:=Cells(1, 1000), lookat:=xlWhole, LookIn:=xlValues, searchdirection:=xlNext).Value = Target: _
        Range("B1").Resize(iRow, iCol - 1).Sort key1:=[B1], order1:=xlAscending, Orientation:=xlByColumns, Header:=xlNo: _
        Range("A2").Resize(iRow - 1, iCol).Sort key1:=[A2], order1:=xlAscending, Orientation:=xlByRows, Header:=xlNo: _
        Cells(1, 1000) = ""
'
If Not Intersect(Target, Range("B2").Resize(iRow - 1, iCol - 1)) Is Nothing Then
    iRow = Target.Row
    With Cells(iRow, iRow)
        .Value = ""
        .Value = WorksheetFunction.Sum(Range("B" & iRow).Resize(1, iCol - 1))
    End With
End If
'
Application.EnableEvents = True
Application.ScreenUpdating = True
'
End Sub
5lemath.xlsm (18.53 Ko)


A+

Salut LeMath,

correction concernant le total de chaque participant qui était calculé n'importe comment...

If Not Intersect(Target, Range("B2").Resize(iRow - 1, iCol - 1)) Is Nothing Then
    iTCol = Target.Column
    With Cells(iTCol, iTCol)
        .Value = ""
        .Value = WorksheetFunction.Sum(Cells(2, Target.Column).Resize(iRow - 1, 1))
    End With
End If
2lemath.xlsm (19.89 Ko)


A+

Rechercher des sujets similaires à "trier suivant lignes colonnes"