VBA Modify Chart Title in Excel

VBA Modify Chart Title

VBA Modify Chart Title in Excel. Let us see how to modify existing chart title using ChartTitle object of the Chart object in Excel VBA.

VBA Modify Chart Title in Excel

VBA modify or change or update chart title using the “ChartTitle” object of the Chart object in Excel. The following code modifies the existing chart title name Sales to the Region Sales Data.

'Modify Chart Title
Sub VBAF1_Modify_Chart_Title()

    'Variable Declaration
    Dim myChart As Chart
    
    'Define or set object
    Set myChart = ActiveSheet.Shapes("myColumnChart").Chart
        
    With myChart
        'Check if chart as already chart
        .HasTitle = True
        'Change or update chart title
        .ChartTitle.Text = "Region Sales Data"
    End With

End Sub

Input screenshot: Here is the screenshot before running the above macro. You can see the existing chart title(Sales) which is highlighted in the below screenshot which we want to change or update or modify.

VBA Chart Name and modifying Chart Title
VBA Chart Name and modifying Chart Title

Output Screenshot: Let us see the screenshot after running the above macro. Here we see updated chart title(Region Sales Data) which we can see in the screenshot.

VBA Modified or updated Chart Title
VBA Modified or updated Chart Title

Step by step instructions to execute macro code or procedure:

You can refer the following link for the step-by-step instructions.

Instructions to run VBA Macro Code

Other Useful Resources:

Click on the following links of the useful resources. These helps to learn and gain more knowledge.

Charts Tutorials Pivot Table Tutorials VBA Arrays VBA Text Files

VBA Tutorial VBA Functions List VBA Tables Blog

VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers

Leave a Comment