Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How to write macro to set the chart scale min/max property?

I have been trying to set the minimum and maximum values for the value axis
in Chart1 using macros without success.

The Help file mentioned below VBA but I tried and it doesn't work. Maybe I
missed out writing some steps.

With Charts("Chart1").Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 120
End With

Anyone can help me??? Many Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to write macro to set the chart scale min/max property?

This is the method if the chart is on the worksheet

ActiveSheet.ChartObjects("Chart 3").Activate
With ActiveChart.Axes(xlCategory)
.MinimumScale = 10
.MaximumScale = 120
End With


The real problem is finding the chart name if is on a worksheet. A chart is
first create as a sheet object and then placed on a worksheet. But the name
is changed when it is moved from a sheet to a an object on a worksheet. the
number increases. Here is one way to verify the name

msgbox(ActiveSheet.ChartObjects(1).name)

The 1 will refere to the first chart on the worksheet. Change the one as
required


"Troubled" wrote:

I have been trying to set the minimum and maximum values for the value axis
in Chart1 using macros without success.

The Help file mentioned below VBA but I tried and it doesn't work. Maybe I
missed out writing some steps.

With Charts("Chart1").Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 120
End With

Anyone can help me??? Many Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to write macro to set the chart scale min/max property?

It works fine for me. Do you get an error

Regards,
Peter T


"Troubled" wrote in message
...
I have been trying to set the minimum and maximum values for the value axis
in Chart1 using macros without success.

The Help file mentioned below VBA but I tried and it doesn't work. Maybe I
missed out writing some steps.

With Charts("Chart1").Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 120
End With

Anyone can help me??? Many Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to write macro to set the chart scale min/max property?

Hi Joel,

Thanks for your help. I managed to find the correct chart name on the
worksheet using the method you taught.

However, the VBA still prompting error "Unable to set the MinimumScale
property of the axis class" when I tried to run the program using the code
that you provided.

Hope that you can help me to solve the problem.

Many Thanks
Chua

"Joel" wrote:

This is the method if the chart is on the worksheet

ActiveSheet.ChartObjects("Chart 3").Activate
With ActiveChart.Axes(xlCategory)
.MinimumScale = 10
.MaximumScale = 120
End With


The real problem is finding the chart name if is on a worksheet. A chart is
first create as a sheet object and then placed on a worksheet. But the name
is changed when it is moved from a sheet to a an object on a worksheet. the
number increases. Here is one way to verify the name

msgbox(ActiveSheet.ChartObjects(1).name)

The 1 will refere to the first chart on the worksheet. Change the one as
required


"Troubled" wrote:

I have been trying to set the minimum and maximum values for the value axis
in Chart1 using macros without success.

The Help file mentioned below VBA but I tried and it doesn't work. Maybe I
missed out writing some steps.

With Charts("Chart1").Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 120
End With

Anyone can help me??? Many Thanks.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to write macro to set the chart scale min/max property?

It gave a error msg "Unable to set the MinimumScale property of the axis
class". Not sure what's went wrong.

Regards
Chua

"Peter T" wrote:

It works fine for me. Do you get an error

Regards,
Peter T


"Troubled" wrote in message
...
I have been trying to set the minimum and maximum values for the value axis
in Chart1 using macros without success.

The Help file mentioned below VBA but I tried and it doesn't work. Maybe I
missed out writing some steps.

With Charts("Chart1").Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 120
End With

Anyone can help me??? Many Thanks.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to write macro to set the chart scale min/max property?

Hi Joel,

Finally solve the puzzle ! !

I managed to set the scale range using another code.....trial and error
luck...*O*

ActiveSheet.ChartObjects("Chart 87").Chart.Axes(xlValue) _
.MaximumScale = Cells(7, 22).Value

ActiveSheet.ChartObjects("Chart 87").Chart.Axes(xlValue) _
.MinimumScale = Cells(7, 41).Value

Thanks for your advice...if not, I will still be searching for the correct
chart name and formula.

Cheers
Chua

"Chua" wrote:

Hi Joel,

Thanks for your help. I managed to find the correct chart name on the
worksheet using the method you taught.

However, the VBA still prompting error "Unable to set the MinimumScale
property of the axis class" when I tried to run the program using the code
that you provided.

Hope that you can help me to solve the problem.

Many Thanks
Chua

"Joel" wrote:

This is the method if the chart is on the worksheet

ActiveSheet.ChartObjects("Chart 3").Activate
With ActiveChart.Axes(xlCategory)
.MinimumScale = 10
.MaximumScale = 120
End With


The real problem is finding the chart name if is on a worksheet. A chart is
first create as a sheet object and then placed on a worksheet. But the name
is changed when it is moved from a sheet to a an object on a worksheet. the
number increases. Here is one way to verify the name

msgbox(ActiveSheet.ChartObjects(1).name)

The 1 will refere to the first chart on the worksheet. Change the one as
required


"Troubled" wrote:

I have been trying to set the minimum and maximum values for the value axis
in Chart1 using macros without success.

The Help file mentioned below VBA but I tried and it doesn't work. Maybe I
missed out writing some steps.

With Charts("Chart1").Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 120
End With

Anyone can help me??? Many Thanks.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically Scale Gantt Chart Time Scale Andrew Lavinsky Charts and Charting in Excel 2 January 31st 10 12:51 PM
How to write a macro to modify an Excel chart raymondvillain Charts and Charting in Excel 4 July 14th 07 04:38 PM
Auto Scale Chart Macro -- Any improvements please? SteveC Charts and Charting in Excel 2 February 19th 07 06:35 PM
Excel can't execute minimum / maximum scale property danz98 Excel Programming 2 August 24th 05 08:38 PM
Changing a chart scale using a formula/macro Doug Charts and Charting in Excel 2 August 10th 05 10:45 PM


All times are GMT +1. The time now is 08:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"