Q:

Edit charts without selecting sheet

I am trying to make changes to various graphs using VBA. I recorded a macro that works, but when I try and remove the sheet selection to speed it up, it just gives an error.
Recorded code:
Sheets("Div").Select
ActiveSheet.ChartObjects("Divi").Activate
ActiveChart.Axes(xlValue).MinimumScale = Sheets("Control").Range("G112").Value

My code:
Worksheets("Div").ChartObjects("Divi").Axes(xlValue).MinimumScale = Sheets("Control").Range("G112").Value

How can I fix it so that I don't need to select each chart?

A:

Try this code that works to me
    With Worksheets("Div").ChartObjects("Divi").Chart.Axes(xlValue)
        .MaximumScale = Sheets("Control").Range("G112").Value
    End With

