Macro in Excel 2010

wims

New Member
Joined
Oct 5, 2011
Messages
2
Hi,
Perhaps someone can help me with this:
In Excel 2003, I've created a macro that automatically sets the minimum and maximum Y-axis scale in a bar chart, based on a calculated cell in the sheet.
below is the macro: FL_REGION is the name of the graph, FL_REGION_MIN is the named cell for the minimum, FL_REGION_MAX is the named cell for the maximum.

ActiveSheet.ChartObjects("FL_REGION").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
ActiveChart.ChartArea.Select
.MinimumScale = ActiveSheet.Range("FL_REGION_MIN").Value
.MaximumScale = ActiveSheet.Range("FL_REGION_MAX").Value
End With


Unfortunately, in Excel 2010, the Y-axis is not adjusted anymore, it keeps the original numbers.

Anyone any idea how I should change the macro?
Thanks.
Wims
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Welcome to the Forum,

If you recorded a macro to adjust this what does the results tell you?
 
Upvote 0
Trevor,
thanks.
I'm not quite sure, but I believe this cannot be recorded. Changing scales cannot be entered by referrinng to a named range, at least I haven't found a way to do that.
Wims
 
Upvote 0
I've just tested your code in 2010 and it works to adjust the scales.
If your workbook was originally created in 2003, you might try recreating the chart in 2010 and see if the code works then.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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