Align zero on secondary axis with primary

sav92

New Member
Joined
Jun 29, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi, I am running a macro to create some charts, my orange line is on the primary axis with the blue and purple are on the secondary. I need the secondary zero point to start at the same as the primary, is there a change to my VBA code that would do this?? Also... how do i change the colour of the lines?


chart.jpg




Worksheets("Chart2").Select
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.FullSeriesCollection(1).Delete
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(1).Name = FileName
ActiveChart.FullSeriesCollection(1).XValues = "=ChartData!$A$3:$A$" & FinalRowChart
ActiveChart.FullSeriesCollection(1).Values = "=ChartData!$B$3:$B$" & FinalRowChart




With ActiveChart
With .SeriesCollection.NewSeries
.XValues = "=ChartData!$P$5:$P$" & FinalRowBL
.Values = "=ChartData!$R$5:$R$" & FinalRowBL
.Name = "BD"
.AxisGroup = 2
End With
End With

With ActiveChart
With .SeriesCollection.NewSeries
.XValues = "=ChartData!$A$3:$A$" & FinalRowChart
.Values = "=ChartData!$G$3:$G$" & FinalRowChart
.Name = "Trace Line"
.AxisGroup = 2
End With
End With
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Unless you work with charts every day, remembering the syntax for everything is hard. The easiest way is to use the macro recorder to record yourself doing what you want (manually), then inspect the macro recorder generated code to determine what needs to be added to your macro.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top