Stack Overflow Asked by user9741285 on December 31, 2020
I wrote this method to create 2 charts:
Dim rng As Range
Dim cht As ChartObject
Dim pos As Range
Set rng = ActiveSheet.Range(data_range)
Set pos = Range(position)
Set cht = ActiveSheet.ChartObjects.Add( _
Left:=pos.Left, _
Width:=breite, _
Top:=pos.Top, _
Height:=hohe)
cht.Chart.HasTitle = True
cht.Chart.ChartTitle.Text = "Statistik"
cht.Chart.ChartTitle.Characters.Font.size = 11
cht.Chart.Legend.Delete
cht.Chart.SetSourceData Source:=rng
The problem is that when I use this method to create two charts, I have a different Y-Scale values (because of auto-scaling maybe) that makes the comparison difficult:
For this reason I need to set a same value for Y-Axis to have a better result.
I should have added this lines to my code:
Dim yax As Axis
Set yax = cht.Chart.Axes(xlValue)
yax.Minimumscale = 100
Now works everything well.
Correct answer by user9741285 on December 31, 2020
You can try with
cht.Axes(xlValue, xlPrimary).MinimumScale = 0
cht.Axes(xlValue, xlPrimary).MaximumScale = 70
Answered by ECO on December 31, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP