bibi
16 janv. 2008 à 01:05
Bon il m'a fallu du temps mais j'ai réussi avec de la bidouille heuuu je suis débutant j'ai au du mal ...
il me reste à supprimer les lignes vides dans la feuille EXPORT puis à triater l'info exporter par choix de l'utilisateur moi entre autre
Sub xxxxx()
Call zz
Dim c As Range
Call blanc
For Each c In Range("Mois")
c.Select
Select Case c
Case Is = 11
Call Bleu
Case Is = 12
Call vert
End Select
Next
'Création d'une nouvelle feuille que l'on nomme EXPORT
Sheets.Add
ActiveSheet.Name = "EXPORT"
Sheets("sstraitance").Select
Call Copie
Sheets("feuil1").Select
Rows(2).Select
Selection.Copy
Sheets("EXPORT").Select
Cells(1, 1).Select
ActiveCell.PasteSpecial
Sheets("feuil1").Select
Cells(1, 1).Activate
End Sub
Sub blanc()
Range("Mois").Interior.ColorIndex = xlNone
Range("Mois").Font.Bold = False
End Sub
Sub vert()
With Selection.Interior
.ColorIndex = 42
.Pattern = xlSolid
End With
End Sub
Sub Bleu()
With Selection.Interior
.ColorIndex = 33
.Pattern = xlSolid
End With
End Sub
Sub zz()
Range("DONNEE").Select
Selection.Sort Key1:=Range("E3"), Order1:=xlDescending, Key2:=Range("g3") _
, Order2:=xlDescending, Key3:=Range("d3") _
, Order3:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
End Sub
Sub Copie()
Dim d As Range
Dim Ligne As Long
'Selection des données de façon optimiser car repere derniere cellule active
ActiveCell.SpecialCells(xlLastCell).Select
Range(Selection, Cells(1)).Select
For Each d In Selection.Rows
Ligne = d.Row
If d.Cells(1, 7).Value = 11 Then
d.Copy
Sheets("EXPORT").Select
Cells(Ligne, 1).Select
Selection.PasteSpecial
End If
Next d
End Sub