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
|
Dim Ch As Chart
Dim i, k, posx, posy, Width, Height As Integer
posx = 0
posy = 0
Width = 600
Height = 300
posx = 80 - 2 * Height
For j = 0 To 8
posx = posx + 2 * Height
posy = 3000 - Width
For i = 0 To 2
posy = posy + Width
Set Ch = ActiveSheet.ChartObjects.Add(posy, posx, Width, Height).Chart
With Ch
'Tabelle13.Shapes.AddChart(xlColumnClustered, Top:=100, Left:=3000, Width:=600, Height:=300).Select
'With ActiveChart
.ChartType = xlColumnClustered
.Axes(xlValue, xlPrimary).MinimumScale = 0
.Axes(xlValue, xlPrimary).MaximumScale = 250
.Axes(xlValue, xlPrimary).MajorUnit = 50
.Axes(xlValue, xlPrimary).MinorUnit = 10
.HasAxis(xlValue, xlSecondary) = True
.Axes(xlValue, xlSecondary).MinimumScale = 0 'la compilation s'arrete là. Si je supprime cette ligne et la suivante, la macro s'execute avec brio
.Axes(xlValue, xlSecondary).MaximumScale = 20
.ChartGroups(1).GapWidth = 0
.ChartGroups(1).Overlap = 100
.HasTitle = True
.ChartTitle.Characters.Text = ActiveSheet.Range("J" & 4 + j * 37) & ":" & Round(ActiveSheet.Range("K" & 4 + j * 37 + i).Value, 3) & " s/mm, Defocus: 0mm"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Text = "Volume"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Text = ""
'.Axes(xlValue, xlSecondary).HasTitle = True
'.Axes(xlValue, xlSecondary).AxisTitle.Text = "Depth (µm)"
For k = 5 To 7
ligne = k + i * 4 + j * 37
With .SeriesCollection.NewSeries
.XValues = Tabelle13.Range("AB4:AP4")
.Values = Tabelle13.Range("AB" & ligne & ":AP" & ligne)
.Name = Format(Tabelle13.Range("AA" & ligne), "0%")
.ErrorBar Direction:=xlY, Include:=xlErrorBarIncludeBoth, Type:=xlErrorBarTypeCustom, Amount:=Tabelle13.Range("AB" & 12 + ligne & ":AP" & 12 + ligne), MinusValues:=Tabelle13.Range("AB" & 24 + ligne & ":AP" & 24 + ligne)
End With
Next k
End With |
Partager