![]() |
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 |
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 |
All times are GMT +1. The time now is 09:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com