Thread: VBA Chart Error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
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