Sub Afficher_Graphique()
comp = ActiveWorkbook.Sheets("Scores").Cells(1, 7)
Call RetablirTout
Dim i As Integer
Dim k As Integer
For i = 1 To 6
For k = 3 To comp + 1
Cells(comp + 1, i) = Cells(1, i)
Cells(comp + 2, i) = 0
Cells(comp + k, i) = Cells(k - 1, i)
Next k
Next i
Charts.Add
With ActiveChart
.SetSourceData Source:=ActiveWorkbook.Sheets("Scores").Range("B" & comp + 1 & ":F" & 2 * comp + 1), PlotBy:=xlColumns
.SeriesCollection(1).XValues = ActiveWorkbook.Sheets("Scores").Range("a" & comp + 2 & ":a" & 2 * comp + 1)
.SeriesCollection(2).XValues = ActiveWorkbook.Sheets("Scores").Range("a" & comp + 2 & ":a" & 2 * comp + 1)
.SeriesCollection(3).XValues = ActiveWorkbook.Sheets("Scores").Range("a" & comp + 2 & ":a" & 2 * comp + 1)
.SeriesCollection(4).XValues = ActiveWorkbook.Sheets("Scores").Range("a" & comp + 2 & ":a" & 2 * comp + 1)
.SeriesCollection(5).XValues = ActiveWorkbook.Sheets("Scores").Range("a" & comp + 2 & ":a" & 2 * comp + 1)
.ChartType = xlXYScatterSmoothNoMarkers
.HasTitle = True
.ChartTitle.Text = "Tarot du " & Format(Date, "dddd d mmm yyyy")
.Name = "Graph"
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Caption = "Points"
.PlotArea.Interior.ColorIndex = xlNone
.PlotArea.Border.ColorIndex = xlNone
.Axes(xlValue).HasMajorGridlines = False
.SeriesCollection(1).Border.ColorIndex = 1
.SeriesCollection(1).Border.Weight = xlMedium
.SeriesCollection(2).Border.ColorIndex = 4
.SeriesCollection(2).Border.Weight = xlMedium
.SeriesCollection(3).Border.ColorIndex = 3
.SeriesCollection(3).Border.Weight = xlMedium
.SeriesCollection(4).Border.ColorIndex = 7
.SeriesCollection(4).Border.Weight = xlMedium
.SeriesCollection(5).Border.ColorIndex = 5
.SeriesCollection(5).Border.Weight = xlMedium
.Deselect
End With
Dim x As Integer
With ActiveWorkbook.VBProject.VBComponents(ActiveWorkbook.Sheets(1).CodeName).CodeModule
x = .CountOfLines
.InsertLines x + 1, "Private Sub Chart_MouseDown(ByVal Button As Long, ByVal Shift As Long,ByVal X As Long, ByVal y As Long)"
.InsertLines x + 2, "ActiveWorkbook.Sheets(2).Activate"
.InsertLines x + 3, "Application.DisplayAlerts = False"
.InsertLines x + 4, "ActiveWorkbook.Sheets(1).Delete"
.InsertLines x + 5, "End Sub"
End With
With ActiveWorkbook.VBProject.VBComponents(Sheets(2).CodeName).CodeModule
x = .CountOfLines
.DeleteLines 1, x
.InsertLines 1, "Private Sub Worksheet_Activate()"
.InsertLines 2, "Application.DisplayAlerts = True"
.InsertLines 3, "Dim comp As Integer"
.InsertLines 4, "comp = ActiveSheet.Cells(1, 7)"
.InsertLines 5, "ActiveSheet.Range(Cells(comp + 1, 1), Cells(2 * comp + 1, 6)).ClearContents"
.InsertLines 6, "Application.Run ""Score_Tarot.xls!MasquerLignesColonnesVides"""
.InsertLines 7, "End Sub"
End With
End Sub