ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   X-axis trouble (https://www.excelbanter.com/excel-programming/347269-x-axis-trouble.html)

BrianDP1977[_8_]

X-axis trouble
 

I'm using the below code to try to define the min and max of the x range
on a chart with two numbers that I have dynamically named in a cell
(Chart_Date_Pmonth and Chart_Date_Tmonth). These numbers change over
time. However, I cannot get the code to accept these named variables.


Code:
--------------------
ActiveChart.Axes(xlValue).Select
Set ActiveChart.Axes(xlValue).MinimumScale = Chart_Date_Pmonth
Set ActiveChart.Axes(xlValue).MaximumScale = Chart_Date_Tmonth
--------------------


--
BrianDP1977
------------------------------------------------------------------------
BrianDP1977's Profile: http://www.excelforum.com/member.php...o&userid=29110
View this thread: http://www.excelforum.com/showthread...hreadid=490530


Wolf

X-axis trouble
 
Hi Brian,

I suppose you variables are defined as "Range", therefore please try

Set ActiveChart.Axes(xlValue).MinimumScale = range("Chart_Date_Pmonth").value
Set ActiveChart.Axes(xlValue).MaximumScale = range("Chart_Date_Tmonth").value

Best regards

Wolf

"BrianDP1977" wrote:


I'm using the below code to try to define the min and max of the x range
on a chart with two numbers that I have dynamically named in a cell
(Chart_Date_Pmonth and Chart_Date_Tmonth). These numbers change over
time. However, I cannot get the code to accept these named variables.


Code:
--------------------
ActiveChart.Axes(xlValue).Select
Set ActiveChart.Axes(xlValue).MinimumScale = Chart_Date_Pmonth
Set ActiveChart.Axes(xlValue).MaximumScale = Chart_Date_Tmonth
--------------------


--
BrianDP1977
------------------------------------------------------------------------
BrianDP1977's Profile: http://www.excelforum.com/member.php...o&userid=29110
View this thread: http://www.excelforum.com/showthread...hreadid=490530



BrianDP1977[_9_]

X-axis trouble
 

Yep, that does it. I got it figured out at about the same time you did.
Thank you very much for the help.


--
BrianDP1977
------------------------------------------------------------------------
BrianDP1977's Profile: http://www.excelforum.com/member.php...o&userid=29110
View this thread: http://www.excelforum.com/showthread...hreadid=490530



All times are GMT +1. The time now is 09:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com