Hello all.
I have a graph in Excel that I created three different graphs for. Each graph is triggered by a button tied to a macro. All works great except the last one.
I want it to have two Axis and it doesn't seem to be registering. Here is my code below.
Thanks for your help.
' BothCreditLineandNumber Macro
'
' Keyboard Shortcut: Ctrl+Shift+T
Sub BothCreditLineandNumber()
Sheets("Roll-up").Unprotect "lending88"
With ActiveSheet.ChartObjects(1).Chart
'Removes old series:
Do Until .SeriesCollection.Count = 0
.SeriesCollection(1).Delete
Loop
'Adds new series:
.SeriesCollection.NewSeries
With .SeriesCollection(1)
.Name = "Credit Lines"
.Values = "='Roll-up'!$K$3:$K$8"
.XValues = "='Roll-up'!$A$3:A8"
End With
With .SeriesCollection.NewSeries
.Name = "New VISAs Booked"
.Values = "='Roll-up'!$J$3:$J$8"
.XValues = "='Roll-up'!$A$3:A8"
.AxisGroup = 2
End With
.ChartType = xlLine
End With
Sheets("Roll-up").Protect "lending88"
End Sub
I have a graph in Excel that I created three different graphs for. Each graph is triggered by a button tied to a macro. All works great except the last one.
I want it to have two Axis and it doesn't seem to be registering. Here is my code below.
Thanks for your help.
' BothCreditLineandNumber Macro
'
' Keyboard Shortcut: Ctrl+Shift+T
Sub BothCreditLineandNumber()
Sheets("Roll-up").Unprotect "lending88"
With ActiveSheet.ChartObjects(1).Chart
'Removes old series:
Do Until .SeriesCollection.Count = 0
.SeriesCollection(1).Delete
Loop
'Adds new series:
.SeriesCollection.NewSeries
With .SeriesCollection(1)
.Name = "Credit Lines"
.Values = "='Roll-up'!$K$3:$K$8"
.XValues = "='Roll-up'!$A$3:A8"
End With
With .SeriesCollection.NewSeries
.Name = "New VISAs Booked"
.Values = "='Roll-up'!$J$3:$J$8"
.XValues = "='Roll-up'!$A$3:A8"
.AxisGroup = 2
End With
.ChartType = xlLine
End With
Sheets("Roll-up").Protect "lending88"
End Sub