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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| Sub Qualite()
'
' Qualite Macro
'
'
Dim dernierLot, dernierCool, dernierTest, dernierMPA, dernierGraphe
Workbooks.Add
ChDir "C:\Documents and Settings\boutteau\Bureau"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\boutteau\Bureau\GrapheTTH.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Windows("TESTPOURQUALITEGandehari.xls").Activate
Windows("GrapheTTH.xls").Activate
ActiveCell.FormulaR1C1 = "LIMITE"
Range("B1").Select
ActiveCell.FormulaR1C1 = "LOT"
Range("C1").Select
ActiveCell.FormulaR1C1 = "COULEE"
Range("D1").Select
ActiveCell.FormulaR1C1 = "TEST"
Range("E1").Select
ActiveCell.FormulaR1C1 = "LOT/COULEE/TEST"
Range("A2").Select
Columns("E:E").ColumnWidth = 18.43
Range("F1").Select
ActiveCell.FormulaR1C1 = "MPA"
Range("A1").Select
Windows("TESTPOURQUALITEGandehari.xls").Activate
Range("D2:D3").Select
Selection.Copy
Windows("GrapheTTH.xls").Activate
Range("A2:A3").Select
ActiveSheet.Paste
dernierLot = Workbooks("TESTPOURQUALITEGandehari.xls").Worksheets("Feuil1").Cells(10000, 3).End(xlUp).Row
dernierCool = Workbooks("TESTPOURQUALITEGandehari.xls").Worksheets("Feuil1").Cells(10000, 2).End(xlUp).Row
dernierTest = Workbooks("TESTPOURQUALITEGandehari.xls").Worksheets("Feuil1").Cells(10000, 1).End(xlUp).Row
dernierMPA = Workbooks("TESTPOURQUALITEGandehari.xls").Worksheets("Feuil1").Cells(10000, 4).End(xlUp).Row
Windows("TESTPOURQUALITEGandehari.xls").Activate
Range("C4:CdernierLot").Select 'Il bloque ici'
Application.CutCopyMode = False
Selection.Copy
Windows("GrapheTTH.xls").Activate
Range("B2").Select
ActiveSheet.Paste
Windows("TESTPOURQUALITEGandehari.xls").Activate
Range("B4:BdernierCool").Select
Application.CutCopyMode = False
Selection.Copy
Windows("GrapheTTH.xls").Activate
Range("C2").Select
ActiveSheet.Paste
Windows("TESTPOURQUALITEGandehari.xls").Activate
Range("A4:AdernierTest").Select
Application.CutCopyMode = False
Selection.Copy
Windows("GrapheTTH.xls").Activate
Range("D2").Select
ActiveSheet.Paste
Windows("TESTPOURQUALITEGandehari.xls").Activate
Range("D4:DdernierMPA").Select
Application.CutCopyMode = False
Selection.Copy
Windows("GrapheTTH.xls").Activate
Range("F2:F14").Select
ActiveSheet.Paste
Range("E2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=CONCATENATE(R[-1]C[-3],R[-1]C[-2],R[-1]C[-1])"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-3],RC[-2],RC[-1])"
Range("E2").Select
dernierGraphe = Workbooks("GrapheTTH.xls").Worksheets("Feuil1").Cells(10000, 6).End(xlUp).Row
Selection.AutoFill Destination:=Range("E2:E24"), Type:=xlFillDefault
Range("E2:E14").Select
Range("E1:FdernierGraphe").Select
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("E1:FdernierGraphe"), PlotBy _
:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "MPA"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Lot/Coulee/Test"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "MPA"
End With
ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowNone, LegendKey:=False
ActiveSheet.Shapes("Graphique 2").IncrementLeft -50.25
ActiveSheet.Shapes("Graphique 2").IncrementTop 95.25
ActiveSheet.Shapes("Graphique 2").ScaleWidth 1.25, msoFalse, _
msoScaleFromTopLeft
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlValue).MajorGridlines.Select
ActiveChart.Axes(xlCategory).Select
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
ActiveChart.Axes(xlValue).MajorGridlines.Select
ActiveChart.ChartArea.Select
ActiveChart.PlotArea.Select
ActiveChart.ShowWindow = True
ActiveSheet.ChartObjects("Graphique 2").Activate
ActiveWindow.Visible = False
End Sub |
Partager