0
0
Excelspreadsheet~10 mins

Column and bar charts in Excel - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a column chart from data in cells A1 to B5.

Excel
ActiveSheet.Shapes.AddChart2(251, [1], Left:=100, Top:=50, Width:=400, Height:=300).Chart.SetSourceData Source:=Range("A1:B5")
Drag options to blanks, or click blank then click option'
AxlBarClustered
BxlPie
CxlLine
DxlColumnClustered
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing xlBarClustered creates a bar chart with horizontal bars.
Choosing xlPie or xlLine creates different chart types.
2fill in blank
medium

Complete the code to set the chart title to 'Sales Data'.

Excel
With ActiveSheet.ChartObjects(1).Chart
  .HasTitle = True
  .ChartTitle.Text = [1]
End With
Drag options to blanks, or click blank then click option'
A"Sales Data"
BSales Data
C'Sales Data'
DSales_Data
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the quotes causes a syntax error.
Using single quotes does not work in VBA strings.
3fill in blank
hard

Fix the error in the code to change the chart type to a bar chart.

Excel
ActiveSheet.ChartObjects(1).Chart.ChartType = [1]
Drag options to blanks, or click blank then click option'
AxlBarClustered
BxlColumnClustered
CBarClustered
DxlPie
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'BarClustered' without 'xl' causes an error.
Choosing xlPie changes to a pie chart instead.
4fill in blank
hard

Fill both blanks to add data labels showing values on the chart.

Excel
With ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)
  .HasDataLabels = [1]
  .DataLabels.ShowValue = [2]
End With
Drag options to blanks, or click blank then click option'
ATrue
BFalse
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting these to False hides the labels.
Using 1 or 0 instead of True/False may cause confusion.
5fill in blank
hard

Fill all three blanks to create a bar chart, set the title to 'Expenses', and show data labels.

Excel
With ActiveSheet.Shapes.AddChart2(251, [1], Left:=50, Top:=50, Width:=400, Height:=300).Chart
  .SetSourceData Source:=Range("A1:B5")
  .HasTitle = True
  .ChartTitle.Text = [2]
  .SeriesCollection(1).HasDataLabels = [3]
End With
Drag options to blanks, or click blank then click option'
AxlColumnClustered
B"Expenses"
CTrue
DxlBarClustered
Attempts:
3 left
💡 Hint
Common Mistakes
Using xlColumnClustered creates a column chart instead.
Forgetting quotes around the title causes errors.
Setting HasDataLabels to False hides labels.