Showing posts with label Add Chart Title Using VBA. Show all posts
Showing posts with label Add Chart Title Using VBA. Show all posts

Saturday, January 19, 2013

Add Chart Title Using VBA

If you want to add chart title using VBA. Try this code-



Sub change_chart_title_using_vba()

Dim cht As Chart

' change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
    
With cht
 .HasTitle = True
 .ChartTitle.Text = "Monthly View"  'chart title
 .ChartTitle.Font.Name = "Arial"
 .ChartTitle.Font.Size = 12
 .ChartTitle.Font.Color = RGB(255, 10, 35)
End With
   
    
End Sub




Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...