Complete the code to add a chart title in Excel VBA.
ActiveChart.HasTitle = True ActiveChart.ChartTitle.Text = [1]
In VBA, text strings must be enclosed in double quotes. So to set the chart title text, use a string like "Sales Data".
Complete the code to show the legend on the chart.
ActiveChart.HasLegend = [1]To display the legend, set HasLegend property to True.
Fix the error in the code to set the X-axis label.
ActiveChart.Axes(xlCategory).HasTitle = True ActiveChart.Axes(xlCategory).AxisTitle.Text = [1]
The axis title text must be a string in quotes, like "X Axis Label".
Fill both blanks to set the Y-axis label and show its title.
With ActiveChart.Axes([1]) .HasTitle = [2] .AxisTitle.Text = "Revenue" End With
The Y-axis is xlValue. To show the title, HasTitle must be True.
Fill all three blanks to add a chart title, show legend, and set X-axis label.
With ActiveChart .HasTitle = [1] .ChartTitle.Text = "Annual Sales" .HasLegend = [2] With .Axes([3]) .HasTitle = True .AxisTitle.Text = "Month" End With End With
To add a title and show legend, set HasTitle and HasLegend to True. The X-axis is xlCategory.
