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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| Sub MiseEnForme()
'
' supprimer lignes négatives Macro
' Macro enregistrée le 06/07/2009 par st22296
'
' Touche de raccourci du clavier: Ctrl+k
'
'****** effacer couleur jaunasse
Range("A2:K1000").Select
Selection.Interior.ColorIndex = xlNone
'******
Dim LigneTrackNegatif As Long
LigneTrackNegatif = 2
Do While LigneTrackNegatif <= 1000 And Cells(LigneTrackNegatif, 15).Value <> ""
If Cells(LigneTrackNegatif, 15).Value < 0 Then
Rows(LigneTrackNegatif).Delete
End If
LigneTrackNegatif = LigneTrackNegatif + 1
Loop
'************** effacer colonnes inutiles
Range("A:A,B:B,M:M,O:O").Select
Selection.Delete
'*************effacer les lignes sans OF
Dim LigneTrackPasOF As Long
LigneTrackPasOF = 2
Do While LigneTrackPasOF <= 1000
If Cells(LigneTrackPasOF, "A").Value = "" Then
Rows(LigneTrackPasOF).Delete
End If
LigneTrackPasOF = LigneTrackPasOF + 1
Loop
'*************************
'********** insérer colonne commentaire et priorité
'Range("M1").Select
'ActiveCell.FormulaR1C1 = "priorité"
'Range("N1").Select
'ActiveCell.FormulaR1C1 = "commentaire"
Range("M1").FormulaR1C1 = "Commentaire"
Range("M1").Value = "Commentaire"
Range("N1").FormulaR1C1 = "Priorité"
Range("N1").Value = "Priorité"
'*************************
'********** insérer dans colonne commentaire "Sans délais"
' si date prévue = VIDE ou =31/12/9999
Dim LigneTrackSansDelais As Long
LigneTrackSansDelais = 2
Do While LigneTrackSansDelais <= 1000
If Cells(LigneTrackSansDelais, "L").Value = "" Or Cells(LigneTrackSansDelais, "L").Value = "31/12/9999" Then
Cells(LigneTrackSansDelais, "M").Value = "Sans Délais"
End If
LigneTrackSansDelais = LigneTrackSansDelais + 1
Loop
'*************************
'********** insérer dans colonne commentaire "Délais dépassé"
' si date prévue <= date du jour
Dim LigneTrackDelaisDepasse As Long
Dim MyDate
LigneTrackDelaisDepasse = 2
Do While LigneTrackDelaisDepasse <= 1000
'MyDate = Cells(LigneTrackDelaisDepasse, 12).DateValue
If Cells(LigneTrackDelaisDepasse, 12) <= Date And Cells(LigneTrackDelaisDepasse, 12) <> "" Then
Cells(LigneTrackDelaisDepasse, 13).Value = "Délais dépassé"
End If
LigneTrackDelaisDepasse = LigneTrackDelaisDepasse + 1
Loop
'*************************
'******************** insérer 4 lignes en haut de la feuille
For i = 1 To 4
Rows(1).Insert
Next i
'*************************
'******************** insérer une légende pour les priorités
'* Besoin URGENT = "priorité 1" F2
Range("F2:G2").Select
Selection.Interior.ColorIndex = 38 '**** rose
Range("F2").Select
ActiveCell.FormulaR1C1 = "* Besoin URGENT = 'priorité 1'"
'* En attente sur avion = " priorité 2" (pourrait devenir urgent) F3
Range("F3:G3").Select
Selection.Interior.ColorIndex = 35 '**** vert
Range("F3").Select
ActiveCell.FormulaR1C1 = "* En attente sur avion = 'priorité 2' (pourrait devenir urgent)"
'************************* insérer FILTRE AUTO
Range("A5:N5").Select
Selection.AutoFilter
'************************* mettre couleur (doré) titre colonnes
Range("A5:N5").Select
Selection.Interior.ColorIndex = 12
End Sub |
Partager