Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 92
Default Error when create chartobject on line ".HasTitle = True"

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   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 92
Default Error when create chartobject on line ".HasTitle = True"

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   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default Error when create chartobject on line ".HasTitle = True"

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
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 create combination stacked area and line chart? BarbAug Charts and Charting in Excel 2 May 19th 05 01:18 PM
How do I create a line graphs with months labelled in the X-axis? Aisha Khan Charts and Charting in Excel 2 February 3rd 05 10:22 PM
Is there a program in office to create a line graph? Chris Excel Discussion (Misc queries) 2 January 17th 05 11:38 PM
How do I create a goal line on a bar chart? dragon4 Charts and Charting in Excel 2 December 30th 04 09:35 PM
create space in line chart between points, linked to pivot table Mike -Z- Charts and Charting in Excel 1 December 7th 04 09:39 PM


All times are GMT +1. The time now is 10:23 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"