Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to place a secondary y axis bar in a bar chart next to two primary y axis bars? | Excel Discussion (Misc queries) | |||
How to place a secondary y axis bar in a bar chart next to two primary y axis bars? | Charts and Charting in Excel | |||
Secondary Axis Match Primary Axis Gridlines | Charts and Charting in Excel | |||
Pivot Table, Line Chart with Secondary Y axis, Page Field selection destroys Y2 axis | Charts and Charting in Excel | |||
Secondary Axis Annual Units sold on 1 Y Axis - Dollar Volume on another | Charts and Charting in Excel |