how can i get this macro to ref to a cell in the current sheet?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everybody,
I need some help with this macro please,
it currently has set values for MinimumScale and MaximumScale, but i need these to change
so Id like to reference these to a cell in the workbook
if i was writing this in english it would read something like this:

ActiveChart.Axes(xlValue).MinimumScale = Activesheet.Cell. EU2
ActiveChart.Axes(xlValue).MaximumScale =Activesheet.Cell. Ev2
(This however doesnt work)
Code:
Sub Macro16()
    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.Axes(xlValue).Select
    ActiveChart.Axes(xlValue).MinimumScale = 5
    ActiveChart.Axes(xlValue).MaximumScale = 7
End Sub

Please would someone help me as I very stuck on this at the moment

Thanks

Tony
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Maybe something like this:

Code:
Sub Macro16()

Dim Min_Scale, Max_Scale


With ActiveSheet
    Min_Scale = .Range("EU2")
    Max_Scale = .Range("EV2")


    .ChartObjects("Chart 1").Activate
    
    ActiveChart.Axes(xlValue).MinimumScale = Min_Scale
    ActiveChart.Axes(xlValue).MaximumScale = Max_Scale
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

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