Successfully Scaled chart X Axis using Cell values but can't get Y Categories to work

pbinvestor

New Member
Joined
Apr 14, 2002
Messages
19
Through the good advice of Healey21 very elegantly was able to rescale my x axis charts using cell inputs with the following code:

Sub Format_charts()
With ActiveSheet.ChartObjects("Chart 6").Chart.Axes(xlValue)
.MaximumScale = Range("v18").Value
.MinimumScale = Range("u18").Value
End With
End Sub

Now I need to scale the Y axis using text categories (stock symbols like SPX,DOW,MMM,AAPL etc.)
All are contained in the range bounded by d13:R13.
Here was my feeble attempt ..

I tried to do the same thing with the y axis by adding the code below using "d13" and "r13" as the category variables but got runtime error 13 "type mismatch"

With ActiveSheet.ChartObjects("Chart 6").Chart.Axes(xlCategory)
.MaximumScale = ActiveSheet.Range("d13").Value
.MinimumScale = ActiveSheet.Range("r13").Value
End With

I guess that the ranges are looking for numbers as opposed to text fields but don't know how to specify (or it seems it should be more complicated than that).
Thanks in advance
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top