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
|
Sub CreeClasseurs()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
On Error Resume Next
Kill "S:\Achats\COMMUN\Tableau de suivi\Production Status\*.*"
On Error GoTo 0
[A4:AF6500].AdvancedFilter Action:=xlFilterCopy, CopyToRange:=[AI4], Unique:=True
For Each c In Range("AI5", Range("AI65000").End(xlUp))
Range("AI5") = c
Sheets.Add
Sheets("Production_Schedule").[A4:AF6500].AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Production_Schedule").[AI4:AI5], CopyToRange:=[A1], Unique:=False
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$AF$2000"), , xlYes).Name = _
"Tableau2"
ActiveSheet.Columns("A:AF").AutoFit
ActiveSheet.Range("A:A,B:B,C:C,F:F,G:G").EntireColumn.Hidden = True
ActiveSheet.Range("D1") = "Production Manager"
ActiveSheet.Range("H1") = "Supplier"
ActiveSheet.Range("E1") = "OA#"
ActiveSheet.Range("I1") = "Style"
ActiveSheet.Range("J1") = "Color"
ActiveSheet.Range("K1") = "Size"
ActiveSheet.Range("L1") = "Order Quantity"
ActiveSheet.Range("M1") = "Order ETD"
ActiveSheet.Range("N1") = "Order Warehouse Date"
ActiveSheet.Range("O1") = "Revised ETD"
ActiveSheet.Range("P1") = "Delay"
ActiveSheet.Range("Q1") = "Partial Qty"
ActiveSheet.Range("R1") = "Balance"
ActiveSheet.Range("Z1") = "FRI status"
ActiveSheet.Range("AE1") = "Warehouse Date"
ActiveSheet.Range("AF1") = "Comments"
ActiveSheet.Copy
nf = Replace(Replace(Replace(Replace(Replace(c, "/", "_"), "&", "_"), "...", "_"), ".", "_"), " ", "_")
Application.ScreenUpdating = False
'----------------------------------------------------
' Mise en forme conditionnelle
Range("A:AH").Select
Selection.FormatConditions.Delete
With Range("A2").Select
Set plage = Range("A2:AH" & Range("A65536").End(xlUp).Row)
plage.FormatConditions.Add Type:=xlExpression, Formula1:="=$AD2<>0"
plage.FormatConditions(1).Interior.ColorIndex = 35
plage.FormatConditions(1).Font.ColorIndex = 1
End With
With Range("Y2").Select
Set plage2 = Range("Y2:Y" & Range("Y65536").End(xlUp).Row)
plage2.FormatConditions.Add Type:=xlExpression, Formula1:="=SI($O2<>"""";$Y2>=$O2;et($E2<>"""";$Y2>=$M2) )"
plage2.FormatConditions(2).Interior.ColorIndex = 3
plage2.FormatConditions(2).Font.ColorIndex = 2
plage2.FormatConditions(2).Font.Bold = True
plage2.FormatConditions.Add Type:=xlExpression, Formula1:="=ET($E2<>"""";$AA2="""";$Y2<>"""";$Y2<AUJOURDHUI())"
plage2.FormatConditions(3).Interior.ColorIndex = 6
plage2.FormatConditions(3).Font.ColorIndex = 1
End With
'------------------------------------------------------------
' Suite du code
ActiveSheet.Name = Left(nf, 31)
ActiveWorkbook.SaveAs Filename:="S:\Achats\COMMUN\Tableau de suivi\Production Status\" & "Production_status_" & nf & "_" & Format(Date, "d-mm-yy")
ActiveWorkbook.Close
ActiveSheet.Delete
Next c
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub |
Partager