Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default VBA Chart Error

I keep getting HasTitle of _Chart has failed error. Any ideas?

Sub MakeChart()
On Error Resume Next
Application.DisplayAlerts = False
Charts("Term Chart").Delete
On Error GoTo 0
Set NewChart = ThisWorkbook.Charts.Add
NewChart.Name = "Term Chart"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Terms"
If FirstRange 1 Then
NewChart.SeriesCollection.Add Source:=FirstRange
End If
If SecondRange 1 Then
NewChart.SeriesCollection.Add Source:=SecondRange
End If
If ThirdRange 1 Then
NewChart.SeriesCollection.Add Source:=ThirdRange
End If
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default VBA Chart Error

The chart needs at least one series before you can add any titles.

Regards,
Peter T

"John" wrote in message
...
I keep getting HasTitle of _Chart has failed error. Any ideas?

Sub MakeChart()
On Error Resume Next
Application.DisplayAlerts = False
Charts("Term Chart").Delete
On Error GoTo 0
Set NewChart = ThisWorkbook.Charts.Add
NewChart.Name = "Term Chart"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Terms"
If FirstRange 1 Then
NewChart.SeriesCollection.Add Source:=FirstRange
End If
If SecondRange 1 Then
NewChart.SeriesCollection.Add Source:=SecondRange
End If
If ThirdRange 1 Then
NewChart.SeriesCollection.Add Source:=ThirdRange
End If
End With
End Sub



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
Excel 2007 error "some chart types cannot be combined with other chart types. Select a different chart types" roadsidetree Charts and Charting in Excel 15 June 2nd 09 10:53 AM
Cannot combine chart type error with only one chart. Kermit Charts and Charting in Excel 8 February 5th 09 06:25 PM
Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error; [email protected] Excel Programming 4 September 16th 07 11:09 PM
Chart error ewan7279 Excel Programming 2 September 5th 07 01:42 PM
Chart Error when using Chart Line - Column on 2 Axes in vba code John Excel Programming 2 August 3rd 07 01:42 PM


All times are GMT +1. The time now is 12:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"