Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
charting code hanging up
I have some code that makes a chart and it works great. However, it only
works if the user's computer recognizes a user-defined chart type. In order to get around it, I am just formating the chart with code. This is a copy of a segment of the original code: ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:="LANL PI" ActiveChart.SetSourceData Source:=Sheets("Data (altered)").Range( _ "A3:E" & numberrows & ",H3:H" & numberrows), PlotBy:=xlColumns ActiveChart.SeriesCollection(1).Name = "=""Performance Index (PI)""" ActiveChart.SeriesCollection(2).Name = "=""Trend""" ActiveChart.SeriesCollection(3).Name = "=""Upper Control Limit""" ActiveChart.SeriesCollection(4).Name = "=""Lower Control Limit""" ActiveChart.SeriesCollection(5).Name = "='Data (altered)'!R21C6" With ActiveChart .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _ "Performance Index" & Chr(10) & "Larger Numbers are Better" .Axes(xlCategory).MaximumScale = endchart '38270 .Axes(xlCategory).MinimumScale = 35339 .Axes(xlCategory).MinorUnit = 366 .Axes(xlCategory).MajorUnit = 366 .Axes(xlCategory).Crosses = xlCustom .Axes(xlCategory).CrossesAt = 0 .Axes(xlCategory).ScaleType = xlLinear .Axes(xlCategory).DisplayUnit = xlNone End With The user-defined code is nothing more than a line chart with a two-color gradient. I have changed the code to look like this: ActiveChart.ChartType = xlLine ActiveChart.SetSourceData Source:=Sheets("Data (altered)").Range( _ "A3:E" & numberrows & ",H3:H" & numberrows), PlotBy:=xlColumns ActiveChart.SeriesCollection(1).Name = "=""Performance Index (PI)""" ActiveChart.SeriesCollection(2).Name = "=""Trend""" ActiveChart.SeriesCollection(3).Name = "=""Upper Control Limit""" ActiveChart.SeriesCollection(4).Name = "=""Lower Control Limit""" ActiveChart.SeriesCollection(5).Name = "='Data (altered)'!R21C6" With ActiveChart.Axes(xlCategory) .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _ "Performance Index" & Chr(10) & "Larger Numbers are Better" 'It gets hung up here .MaximumScale = endchart '38270 .MinimumScale = 35339 .MinorUnit = 366 .MajorUnit = 366 .Crosses = xlCustom .CrossesAt = 0 .ScaleType = xlLinear .DisplayUnit = xlNone End With With ActiveChart.PlotArea.Fill .Visible = True .ForeColor.SchemeColor = 35 .BackColor.SchemeColor = 22 End With What would be making it get hung up at that point? That line worked before. TIA |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
selection hanging | New Users to Excel | |||
CHARTING CODE ERROR | Excel Discussion (Misc queries) | |||
Why doesn't Excel 2007 record charting and office art macro code? | Excel Discussion (Misc queries) | |||
Excel hanging up | Excel Programming | |||
Automated charting VB code problem | Excel Programming |