Hello,
I'm trying to use VBA to alter the parameters of my chart. But specifically with the Ticklabels.Offset - I get "Run time error 1004 - Parameter not valid", and I can't work out why.
The code below works for the maximum scale and minimum scale, then gets an error where labelled.
I have also tried recording the macro, but when I run it again I get the error on the 5th line
Thanks for your help
I'm trying to use VBA to alter the parameters of my chart. But specifically with the Ticklabels.Offset - I get "Run time error 1004 - Parameter not valid", and I can't work out why.
The code below works for the maximum scale and minimum scale, then gets an error where labelled.
Code:
ActiveSheet.ChartObjects("Chart 2").Activate
With ActiveChart.Axes(xlValue, xlPrimary) 'y-axis of chart
.MaximumScale = ActiveSheet.Range("AC63").Value
.MinimumScale = ActiveSheet.Range("AE63").Value
End With
With ActiveChart.Axes(xlCategory).TickLabels
.Offset = -(ActiveSheet.Range("AE63").Value) / 7 ' error here
End With
I have also tried recording the macro, but when I run it again I get the error on the 5th line
Code:
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).MajorGridlines.Select
ActiveChart.Axes(xlCategory).Select
ActiveChart.Axes(xlCategory).TickLabels.Offset = 5000 'error here
Application.CommandBars("Format Object").Visible = False
Thanks for your help