Hi,
I have a stacked bar chart which is in essence a Gantt chart. I want it to work on multiple projects however for this to happen I need the Minimum values dynamic. I got the below code from another forum yet it keeps producing the following error
Run Time Error -2147467259 (80004005)':
Method of 'MinimumScale' of object Axis Failed.
Would anyone have any ideas on where I am going wrong?
Sub ScaleAxes()
With Application.ActiveChart.Axes(xlCategory, xlPrimary)
.MinimumScale = ActiveSheet.Range("F3").Value
.MaximumScale = ActiveSheet.Range("F2").Value
.MajorUnit = ActiveSheet.Range("F4").Value
End With
With Application.ActiveChart.Axes(xlValue, xlPrimary)
.MinimumScale = ActiveSheet.Range("G3").Value
.MaximumScale = ActiveSheet.Range("G2").Value
.MajorUnit = ActiveSheet.Range("G4").Value
End With
End Sub
I have a stacked bar chart which is in essence a Gantt chart. I want it to work on multiple projects however for this to happen I need the Minimum values dynamic. I got the below code from another forum yet it keeps producing the following error
Run Time Error -2147467259 (80004005)':
Method of 'MinimumScale' of object Axis Failed.
Would anyone have any ideas on where I am going wrong?
Sub ScaleAxes()
With Application.ActiveChart.Axes(xlCategory, xlPrimary)
.MinimumScale = ActiveSheet.Range("F3").Value
.MaximumScale = ActiveSheet.Range("F2").Value
.MajorUnit = ActiveSheet.Range("F4").Value
End With
With Application.ActiveChart.Axes(xlValue, xlPrimary)
.MinimumScale = ActiveSheet.Range("G3").Value
.MaximumScale = ActiveSheet.Range("G2").Value
.MajorUnit = ActiveSheet.Range("G4").Value
End With
End Sub