#1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1,670
Default secondary Y axis

I am trying to write a macro for two y axises. Left side is english (pounds
per cubic foot) and the right is metric. What I have now will allow me to
graph the english with no problem but when I try to add a second y axis I
then don't get any points on the graph. Can anyone help.....Here is the
macro I am using.

column S is moisture content
Column T is english version
Column U is meteric version

Range("AD7").Select
Application.CutCopyMode = False
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Range("S19:U22"), _
PlotBy:=xlColumns
ActiveWindow.Visible = False
Range("k4").Select

'english units
ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate

With ActiveChart.Axes(xlValue)
..MinimumScale = 1
..MaximumScale = 1
..MinorUnitIsAuto = True
..MajorUnitIsAuto = True
..Crosses = xlAutomatic
..ReversePlotOrder = False
..ScaleType = False
End With
ActiveWindow.Visible = False
Range("b41").Select

'secondary axis
'With ActiveChart.Axes(xlValue, xlSecondary)
'.MaximumScale = ActiveSheet.Range("t12") * 16.01846
'.MinimumScale = ActiveSheet.Range("s12") * 16.01846

'End With


ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
..MaximumScale = ActiveSheet.Range("t12")
..MinimumScale = ActiveSheet.Range("s12")
..MinorUnit = 20
..MajorUnit = 1
..Crosses = xlAutomatic
..ReversePlotOrder = False
ScaleType = False
..TickLabels.NumberFormat = "0.0"

End With


'Case Else
'End Select

'x scale
Application.ScreenUpdating = False
ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
With ActiveChart.Axes(xlCategory)
.MaximumScale = ActiveSheet.Range("s22")
.MinimumScale = ActiveSheet.Range("s19")
.Crosses = xlAutomatic
.ReversePlotOrder = False
' .ScaleType = False
End With

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 126
Default secondary Y axis

I don't see anywhere in the code where you specify that the series
corresponding to col. U should use the secondary axis. You should do
that before you set the Secondary Axis attributes.

On Wed, 27 Aug 2008 11:36:13 -0700, Eric
wrote:

I am trying to write a macro for two y axises. Left side is english
(pounds
per cubic foot) and the right is metric. What I have now will allow
me to
graph the english with no problem but when I try to add a second y
axis I
then don't get any points on the graph. Can anyone help.....Here is
the
macro I am using.

column S is moisture content
Column T is english version
Column U is meteric version

Range("AD7").Select
Application.CutCopyMode = False
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Range("S19:U22"), _
PlotBy:=xlColumns
ActiveWindow.Visible = False
Range("k4").Select

'english units
ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate

With ActiveChart.Axes(xlValue)
..MinimumScale = 1
..MaximumScale = 1
..MinorUnitIsAuto = True
..MajorUnitIsAuto = True
..Crosses = xlAutomatic
..ReversePlotOrder = False
..ScaleType = False
End With
ActiveWindow.Visible = False
Range("b41").Select

'secondary axis
'With ActiveChart.Axes(xlValue, xlSecondary)
'.MaximumScale = ActiveSheet.Range("t12") * 16.01846
'.MinimumScale = ActiveSheet.Range("s12") * 16.01846

'End With


ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
..MaximumScale = ActiveSheet.Range("t12")
..MinimumScale = ActiveSheet.Range("s12")
..MinorUnit = 20
..MajorUnit = 1
..Crosses = xlAutomatic
..ReversePlotOrder = False
ScaleType = False
..TickLabels.NumberFormat = "0.0"

End With


'Case Else
'End Select

'x scale
Application.ScreenUpdating = False
ActiveSheet.DrawingObjects("chart 7").Select
ActiveSheet.ChartObjects("chart 7").Activate
With ActiveChart.Axes(xlCategory)
.MaximumScale = ActiveSheet.Range("s22")
.MinimumScale = ActiveSheet.Range("s19")
.Crosses = xlAutomatic
.ReversePlotOrder = False
' .ScaleType = False
End With

End Sub

Regards,

Tushar Mehta
Microsoft MVP Excel 2000-2008
www.tushar-mehta.com
Tutorials and add-ins for Excel, PowerPoint, and other products
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
How to place a secondary y axis bar in a bar chart next to two primary y axis bars? Dmitry Excel Discussion (Misc queries) 3 May 4th 06 01:58 AM
How to place a secondary y axis bar in a bar chart next to two primary y axis bars? Dmitry Charts and Charting in Excel 2 May 4th 06 01:58 AM
Secondary Axis Match Primary Axis Gridlines [email protected] Charts and Charting in Excel 1 July 31st 05 09:23 PM
Pivot Table, Line Chart with Secondary Y axis, Page Field selection destroys Y2 axis [email protected] Charts and Charting in Excel 0 July 13th 05 09:30 PM
Secondary Axis Annual Units sold on 1 Y Axis - Dollar Volume on another John Smith Charts and Charting in Excel 7 December 21st 04 08:26 PM


All times are GMT +1. The time now is 06:27 PM.

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"