1、首先在开发工具中打开VBA编辑器

2、在单元格区域当中输入一些内容作为例子

3、在VBA编辑器中插入模块

4、在模块当中输入如下代码,然后运行
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address="$E$2" Then
ActiveSheet.ChartObjects("图表 2").Activate
Select Case Target.Text
Case "柱形图"
ActiveChart.ChartType=xlColumnClustered
Case "折线图"
ActiveChart.ChartType=xlLineMarkers
Case "面积图"
ActiveChart.ChartType=xlArea
Case "饼图"
ActiveChart.ChartType=xlPie
Case "圆环图"
ActiveChart.ChartType=xlDoughnut
Case "散点图"
ActiveChart.ChartType=xlXYScatter
End Select
End If
End Sub

5、单击单元格E1,从下拉选项中选择任意名称,则图表立即更改为相应类型的图表
