# Set chart properties without selecting chart



## davidam (Dec 31, 2022)

Hi,
According to Microsoft documentation, I should be able to set the Axis.MinimumScale and AxisMaximumnScale properties as follows:

```
With Charts("Chart1").Axes(xlValue)
 .MinimumScale = 10  
.MaximumScale = 120  
End With
```
 However, I cannot make this, or any permutation like it, work and I am forced to activate charts in order to set these properties.
I use:

```
runSheet.ChartObjects("Chart 1").Activate
    ActiveChart.Axes(xlValue).MinimumScale = runSheet.Range("P37").Value
    ActiveChart.Axes(xlValue).MaximumScale = runSheet.Range("O36").Value
    
    runSheet.ChartObjects("Chart 2").Activate
    ActiveChart.Axes(xlValue).MinimumScale = runSheet.Range("P37").Value
    ActiveChart.Axes(xlValue).MaximumScale = runSheet.Range("O36").Value
```

This really seems to slow things down.  At the very least I would like to be able to speed this process up.
Thanks in advance
David


----------



## Domenic (Dec 31, 2022)

Try it this way . . .


```
With runSheet.ChartObjects("Chart 1").Chart
        .Axes(xlValue).MinimumScale = runSheet.Range("P37").Value
        .Axes(xlValue).MaximumScale = runSheet.Range("O36").Value
    End With
```

And the same thing for your other chart.

Hope this helps!


----------



## davidam (Dec 31, 2022)

Domenic said:


> Try it this way . . .
> 
> 
> ```
> ...


Domenic,
That did the trick!  Thanks so much!
I have not been on this great site for a while and is so nice to know that there is still great help available.
Happy New Year to All.
David


----------



## Domenic (Dec 31, 2022)

You're very welcome, I'm glad I could help.

And Happy New Year to you too!


----------



## smozgur (Dec 31, 2022)

davidam said:


> Domenic,
> That did the trick!  Thanks so much!
> I have not been on this great site for a while and is so nice to know that there is still great help available.
> Happy New Year to All.
> David


Therefore, I switched the marked solution post accordingly.

Happy New Year!


----------

