Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Hi,
I gett runtime 1004 at line "HasTitle = True" The peculiar thing is that yesterday it worked ok. I saved it, slept, and now I get the error. I have tested to put the Has title ocde in the end of the sub, after seriescollections etc, but with same results. Any ideas, anybody? /Kind regards tskogstrom Sub CreateChartCF() Dim cht As Chart Dim chtTitle As String chtTitle = "CashFlow & PayBack" On Error Resume Next '(if no chartobject) Sheet2.ChartObjects("R_CF").Delete On Error GoTo 0 If Sheet1.Range("Years").Value 1 Then With Sheet2.ChartObjects.Add(Range("RAPP_BASE_CHT_CF"). Left, _ Range("RAPP_BASE_CHT_CF").Top, 468, 260) .Name = "R_CF" End With Set cht = Sheet2.ChartObjects("R_CF").Chart With cht .ChartType = xlColumnClustered .SetSourceData Sheet10.Range("CHT_CFSOURCE_" & Sheet2.Range("RAPP_TILLF").Value), _ PlotBy:=xlRows .HasTitle = True .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False .ChartTitle.Characters.Text = chtTitle End With With cht.SeriesCollection(1) .Fill.OneColorGradient Style:=msoGradientVertical, Variant:=4, _ Degree:=0.25 .Fill.Visible = True .Fill.ForeColor.SchemeColor = 47 End With With cht.SeriesCollection(2) .Fill.OneColorGradient Style:=msoGradientVertical, Variant:=4, _ Degree:=0.25 .Fill.Visible = True .Fill.ForeColor.SchemeColor = 45 End With ....etc etc |
#2
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
It seems that if the source is hidden rows or columns, I get the error
!! Is this really correct? Is there any workarounds in code, or do I need to create a new sheet with linked sourceranges? That would be some trouble to me ... /Regards tskogstrom tskogstrom skrev: Hi, I gett runtime 1004 at line "HasTitle = True" The peculiar thing is that yesterday it worked ok. I saved it, slept, and now I get the error. I have tested to put the Has title ocde in the end of the sub, after seriescollections etc, but with same results. Any ideas, anybody? /Kind regards tskogstrom Sub CreateChartCF() Dim cht As Chart Dim chtTitle As String chtTitle = "CashFlow & PayBack" On Error Resume Next '(if no chartobject) Sheet2.ChartObjects("R_CF").Delete On Error GoTo 0 If Sheet1.Range("Years").Value 1 Then With Sheet2.ChartObjects.Add(Range("RAPP_BASE_CHT_CF"). Left, _ Range("RAPP_BASE_CHT_CF").Top, 468, 260) .Name = "R_CF" End With Set cht = Sheet2.ChartObjects("R_CF").Chart With cht .ChartType = xlColumnClustered .SetSourceData Sheet10.Range("CHT_CFSOURCE_" & Sheet2.Range("RAPP_TILLF").Value), _ PlotBy:=xlRows .HasTitle = True .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False .ChartTitle.Characters.Text = chtTitle End With With cht.SeriesCollection(1) .Fill.OneColorGradient Style:=msoGradientVertical, Variant:=4, _ Degree:=0.25 .Fill.Visible = True .Fill.ForeColor.SchemeColor = 47 End With With cht.SeriesCollection(2) .Fill.OneColorGradient Style:=msoGradientVertical, Variant:=4, _ Degree:=0.25 .Fill.Visible = True .Fill.ForeColor.SchemeColor = 45 End With ...etc etc |
#3
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Hi,
If your chart contains no data then either manually or with code you will not be able to set the chart title. If you need a chart title even when no data is present you could add a dummy series. Cheers Andy tskogstrom wrote: It seems that if the source is hidden rows or columns, I get the error !! Is this really correct? Is there any workarounds in code, or do I need to create a new sheet with linked sourceranges? That would be some trouble to me ... /Regards tskogstrom tskogstrom skrev: Hi, I gett runtime 1004 at line "HasTitle = True" The peculiar thing is that yesterday it worked ok. I saved it, slept, and now I get the error. I have tested to put the Has title ocde in the end of the sub, after seriescollections etc, but with same results. Any ideas, anybody? /Kind regards tskogstrom Sub CreateChartCF() Dim cht As Chart Dim chtTitle As String chtTitle = "CashFlow & PayBack" On Error Resume Next '(if no chartobject) Sheet2.ChartObjects("R_CF").Delete On Error GoTo 0 If Sheet1.Range("Years").Value 1 Then With Sheet2.ChartObjects.Add(Range("RAPP_BASE_CHT_CF"). Left, _ Range("RAPP_BASE_CHT_CF").Top, 468, 260) .Name = "R_CF" End With Set cht = Sheet2.ChartObjects("R_CF").Chart With cht .ChartType = xlColumnClustered .SetSourceData Sheet10.Range("CHT_CFSOURCE_" & Sheet2.Range("RAPP_TILLF").Value), _ PlotBy:=xlRows .HasTitle = True .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False .ChartTitle.Characters.Text = chtTitle End With With cht.SeriesCollection(1) .Fill.OneColorGradient Style:=msoGradientVertical, Variant:=4, _ Degree:=0.25 .Fill.Visible = True .Fill.ForeColor.SchemeColor = 47 End With With cht.SeriesCollection(2) .Fill.OneColorGradient Style:=msoGradientVertical, Variant:=4, _ Degree:=0.25 .Fill.Visible = True .Fill.ForeColor.SchemeColor = 45 End With ...etc etc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to create combination stacked area and line chart? | Charts and Charting in Excel | |||
How do I create a line graphs with months labelled in the X-axis? | Charts and Charting in Excel | |||
Is there a program in office to create a line graph? | Excel Discussion (Misc queries) | |||
How do I create a goal line on a bar chart? | Charts and Charting in Excel | |||
create space in line chart between points, linked to pivot table | Charts and Charting in Excel |