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
| Private Sub Cmd_Graph_Click()
Dim U As Range
Dim Sh As Worksheet
Dim Ch As Chart
Dim LastCol
Set Sh = ThisWorkbook.Worksheets("SYN")
Set U = Sh.Range("A:A").Find(Label_Cbo_UnitServ.Caption, LookIn:=xlValues, lookat:=xlWhole)
If U Is Nothing Then
MsgBox "UN PROBLEME EST SURVENU. Veuillez contacter un support"
Else
LastCol = Sh.Cells(U.Row, Sh.Columns.Count).End(xlToLeft).Column
Union(U.Resize(1, LastCol), Sh.Range("A28").Resize(2, LastCol)).Select
Set Ch = ThisWorkbook.Charts.Add
With Ch
.ChartType = xlXYScatterSmooth
'Adapte A1 ci-après par la cellule contenant Semaines
.SetSourceData Source:=Union(Sh.Range("A1").Resize(1, LastCol), U.Resize(1, LastCol), Sh.Range("A28").Resize(2, LastCol))
'Mise en forme du graph
.Axes(xlCategory).MinimumScale = 39
.Axes(xlCategory).MaximumScale = 52
.Axes(xlValue).MinimumScale = 0
.Axes(xlValue).MaximumScale = 1
.ApplyLayout 8
.ChartTitle.Text = "Audit Rangement-Propreté"
End With
Set Ch = Nothing
Set U = Nothing
End If
Set Sh = Nothing
End Sub |