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
| Sub Export()
'
' Export Macro
'' selection de la cellule de la condition du filtre
Sheets("RETOUR").Activate
'Action de filtrage
Sheets("DONNEES").Range("$A$3:$R$10000").AutoFilter Field:=20, Criteria1:="<>"
Sheets("DONNEES").Range("$A$3:$R$10000").AutoFilter Field:=26, Criteria1:=""
' sélection du résultat du filtre
Sheets("DONNEES").Range("A3:A10000,L3:L10000,M3:M10000,O3:O10000,P3:P10000,R3:R10000,S3:S10000,AA3:AA10000").Copy Destination:=Sheets("RETOUR").Range("G2")
'Supprime les doublons
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
[G2].Sort Key1:=Range("G3"), Order1:=xlAscending, Header:=xlGuess
For i = [A65000].End(xlUp).Row To 2 Step -1
If Cells(i, 1) = Cells(i - 1, 1) Then Rows(i).Delete
Next i
Application.Calculation = xlCalculationAutomatic
'ranger colonnes
[I2].Sort Key1:=Range("I3"), Order1:=xlAscending, Header:=xlGuess
Columns("N:N").WrapText = True
' remise à 0 des filtres
With Sheets("DONNEES")
If .AutoFilterMode And .FilterMode Then .ShowAllData
End With
End Sub |
Partager