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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,216,069
Messages
6,128,599
Members
449,460
Latest member
jgharbawi

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