Bonjour,
J'ai plusieurs fiches "collées" côte à côte (oui, je sais... mais changer les habitudes des utilisateurs est trèèès compliqué), et je souhaiterais faire un tri sur une plage donnée pour chaque fiche. J'ai la macro de tri qui fonctionne, mais j'ai un problème avec la boucle. J'apprécierais un petit coup de main...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Sub Filtre()
'
' Filtre Macro
'
'
Dim Cell As Range
'
Range("6:6").Select
For Each Cell In Selection
If Cell.Value <> "" Then
    If Cell = "Nb tiges fleurs" Then
    Set ActiveCell = Cell.Offset(x, y)
    Range("Cell.Offset(4, 0):Cell.Offset(22, 4)").Select
    ActiveWorkbook.Worksheets("chiffrage").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("chiffrage").Sort.SortFields.Add Key:=Range("Cell.Offset(4, 0)") _
        , SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("chiffrage").Sort.SortFields.Add Key:=Range("Cell.Offset(4, 1)") _
        , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("chiffrage").Sort
        .SetRange Range("Cell.Offset(4, 0):Cell.Offset(22, 4)")
        .Header = xlNo
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
        End With
    End If
    End If
    Next Cell
End Sub
Merci d'avance