Hello
I have a Chart in a Worksheet. In the Chart, I am trying to set xlPrimary axis and xlSecondaryaxis to none.
I opened the workbook in Excel and made the changes manually with the Recorder on.
This is the recorded macro code:
However, when I run the macro code VBA displays error91 in this line:
VBA Run-time Error '91'
Object-variable or With block variable are not set
Then I tried this code:
Again VBA displays the same error
in this line:
Please, could anyone to help me to fix this error
Thanks in advance
I have a Chart in a Worksheet. In the Chart, I am trying to set xlPrimary axis and xlSecondaryaxis to none.
I opened the workbook in Excel and made the changes manually with the Recorder on.
This is the recorded macro code:
Code:
ActiveChart.Axes(xlValue, xlSecondary).Select
Selection.TickLabelPosition = xlNone
However, when I run the macro code VBA displays error91 in this line:
Code:
ActiveChart.Axes(xlValue, xlSecondary).Selec

Object-variable or With block variable are not set
Then I tried this code:
Code:
Dim ws As WorksheetDim ch As Chart
Set ch = ActiveChart
With ch.Axes(xlValue, xlSecondary).Select
Selection.TickLabelPosition = xlNone
End With

Code:
With ch.Axes(xlValue, xlSecondary).Select
Please, could anyone to help me to fix this error
Thanks in advance