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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
Sub Macro1()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Call ClearAll
Call copierDonnees
Call ViderPressePapier
Call creerGraph
Call MEFGraph
Worksheets("Données").Select
Range("A1").Select
Workbooks("SurveillanceOutils.xls").Save
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Sub ViderPressePapier()
OpenClipboard 0
EmptyClipboard
CloseClipboard
End Sub
Sub ClearAll()
Application.DisplayAlerts = False
If Charts.Count <> 0 Then
Charts.Delete
End If
Worksheets("Données").Cells.clear
Worksheets("Données").Range("A1").Select
Application.DisplayAlerts = True
End Sub
Sub copierDonnees()
Application.DisplayAlerts = False
'Workbooks.OpenText Filename:="Feuil1.TextBox1.Value & ".txt", _
Origin:=xlWindows, Tab:=True
Workbooks(Feuil1.TextBox1.Value & ".txt").Sheets(Feuil1.TextBox1.Value).Range("A1:G100").Copy
Windows("SurveillanceOutils.xls").Activate
Feuil1.Range("A1").Select
ActiveSheet.Paste
Workbooks(Feuil1.TextBox1.Value & ".txt").Close
End Sub
Sub creerGraph()
Dim i As Integer
i = 1
Do While (Feuil1.Cells(i + 1, 1) <> "")
i = i + 1
Loop
Charts.Add
ActiveChart.Name = "Graph"
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Feuil1.Range("B1:G" & i), PlotBy _
:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet
End Sub
Sub MEFGraph()
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Outil " & Feuil1.TextBox1.Value
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Temps"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
"Durée de vie restante (min)"
End With
ActiveChart.HasLegend = True
ActiveChart.Legend.Left = 645
ActiveChart.Legend.Top = 1
With ActiveChart.Legend.LegendEntries(1).LegendKey.Border
.ColorIndex = 33
.Weight = xlMedium
End With
With ActiveChart.Legend.LegendEntries(2).LegendKey.Border
.ColorIndex = 8
.Weight = xlMedium
End With
With ActiveChart.Legend.LegendEntries(3).LegendKey.Border
.ColorIndex = 4
.Weight = xlMedium
End With
With ActiveChart.Legend.LegendEntries(4).LegendKey.Border
.ColorIndex = 44
.Weight = xlMedium
End With
With ActiveChart.Legend.LegendEntries(5).LegendKey.Border
.ColorIndex = 7
.Weight = xlMedium
End With
With ActiveChart.Legend.LegendEntries(6).LegendKey.Border
.ColorIndex = 54
.Weight = xlMedium
End With
With ActiveChart.PlotArea.Interior
.ColorIndex = 48
.PatternColorIndex = 1
.Pattern = xlSolid
End With
End Sub |
Partager