
Originally Posted by
FDibbins
Nope, you can only have 1 scale per axis.
A work around might be to increase the 2nd set of values by a factor of 40
Thanks for helping!
I'm really surprised that we're now in 2021, and Excel hasn't added this basic feature!
It would be easy to create two columns on the right or left side of the chart, with
different scales.
Let's see if we can possibly work with your 'work around'.
I will show you the graph creation code that I now have below.
For me the tricky part would be to adjust the multiplication factor according to
the data for each location.
For example for location A, the factor might be x40.
For location B, the factor might be x10.
etc.
So first I would need code to check through the data for each location that will be charted,
find the biggest number in Col B for that location, say it was 3200, and then multiply the
numbers in Col D by a factor of perhaps 20 (Col D will always be between 0-100).
Sub makechart(title1 As String, SourceData As String)
Dim ChartSheet As Worksheet
Set ChartSheet = ThisWorkbook.Worksheets("Charts")
Dim iChtIx As Long
iChtIx = ChartSheet.ChartObjects.Count + 1
Dim cht As Chart
Set cht = ChartSheet.Shapes.AddChart2(XlChartType:=xlColumnClustered, Width:=MyWidth, Height:=MyHeight, Left:=((iChtIx - 1) Mod NumWide) * MyWidth, Top:=Int((iChtIx - 1) / NumWide) * MyHeight).Chart
With cht
.SetSourceData Source:=Range(SourceData), PlotBy:=xlColumns
.FullSeriesCollection(1).ChartType = xlLine
.FullSeriesCollection(2).ChartType = xlColumnClustered
.FullSeriesCollection(3).ChartType = xlLine
.SeriesCollection(1).Name = "=""Data1"""
.SeriesCollection(2).Name = "=""Data2"""
.SeriesCollection(3).Name = "=""Data3"""
cht.HasLegend = True
cht.FullSeriesCollection(1).Select
ActiveChart.FullSeriesCollection(1).Select
ActiveChart.FullSeriesCollection(1).AxisGroup = 2
cht.FullSeriesCollection(3).Select
ActiveChart.FullSeriesCollection(3).Select
ActiveChart.FullSeriesCollection(3).AxisGroup = 2
.HasTitle = True
.ChartTitle.Characters.Text = title1
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
Call EnableChartEvents(cht)
End With
End Sub
Bookmarks