Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting Y axis values based on other chart


Can anyone help me with this problem, or let me know if it is no
possible in Excel :) ?

I have 2 charts, but want to use the Y-axis values from the 1st char
for the 2nd chart too. The values on the 1st chart can be automatic
but I want the 2nd chart to be plotted on the same scale as the firs
without having to go in an manually change the minimum and maximu
values.

Can this be done in VBA ?
Thanks for any help you can give. :)
Amy x

--
AmyTaylo
-----------------------------------------------------------------------
AmyTaylor's Profile: http://www.excelforum.com/member.php...fo&userid=2097
View this thread: http://www.excelforum.com/showthread.php?threadid=38081

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Formatting Y axis values based on other chart

To work with a chart in VBA, first you need to know how to reference it. If
it is a chart sheet, it would be ThisWorkbook.Charts("SheetName"). If the
charts are objects placed on a "regular" sheet then you use
Worksheets("SheetName").ChartObjects(n).Chart (where n is an index number for
the chart).

Then, to get at the Y axis scale, you would use the Axes(xlValue) property:
from here there are several properties related to scale (corresponding to the
properties you see when setting up the chart manually, the most relevant ones
being:
MinimumScale
MaximumScale
MajorUnit
MinorUnit

So you could copy from your first chart to the second:

Dim Chart1YAxis as Axis, Chart2YAxis as Axis
Set Chart1YAxis = Worksheets("SheetName").ChartObjects(1).Chart.Axes (xlValue)
Set Chart2YAxis = Worksheets("SheetName").ChartObjects(2).Chart.Axes (xlValue)
With Chart2YAxis
.MinimumScale = Chart1YAxis.MinimumScale
.MaximumScale = Chart1YAxis.MaximumScale
.MajorUnit = Chart1YAxis.MajorUnit
.MinorUnit = Chart1YAxis.MinorUnit
End With

HTH!

"AmyTaylor" wrote:


Can anyone help me with this problem, or let me know if it is not
possible in Excel :) ?

I have 2 charts, but want to use the Y-axis values from the 1st chart
for the 2nd chart too. The values on the 1st chart can be automatic,
but I want the 2nd chart to be plotted on the same scale as the first
without having to go in an manually change the minimum and maximum
values.

Can this be done in VBA ?
Thanks for any help you can give. :)
Amy xx


--
AmyTaylor
------------------------------------------------------------------------
AmyTaylor's Profile: http://www.excelforum.com/member.php...o&userid=20970
View this thread: http://www.excelforum.com/showthread...hreadid=380815


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting Y axis values based on other chart


Dales, thanks for your reply, and your help :)
I will give your suggestion a shot, and get back to you if it doesnt
help....if I may :)
Thank you again
Amy xx


--
AmyTaylor
------------------------------------------------------------------------
AmyTaylor's Profile: http://www.excelforum.com/member.php...o&userid=20970
View this thread: http://www.excelforum.com/showthread...hreadid=380815

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
Formatting the font of X axis values Tigerxxx Excel Discussion (Misc queries) 2 July 27th 09 07:44 PM
Pivot based chart and adding secondary axis DKS Charts and Charting in Excel 4 April 19th 08 07:37 PM
chart from pivot data does not update x-axis bar chart values - bug jason gers Excel Discussion (Misc queries) 0 April 3rd 07 06:34 PM
how to put x axis values in the chart instead of x axis labels Sinclair Charts and Charting in Excel 1 June 21st 05 11:04 AM
How do I change X-Axis values in a chart with 2 Y-Axis? ESGLCC Charts and Charting in Excel 1 May 4th 05 02:41 PM


All times are GMT +1. The time now is 11:14 AM.

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

About Us

"It's about Microsoft Excel"