手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

怎样使用VBA随心所欲显示图表类型

时间:2024-10-11 19:46:11

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

怎样使用VBA随心所欲显示图表类型

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

怎样使用VBA随心所欲显示图表类型

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

怎样使用VBA随心所欲显示图表类型

4、在模块当中输入如下代码,然后运行Private Sub Worksheet_Cha艘绒庳焰nge(ByVal Target As Ra荏鱿胫协nge) 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 IfEnd Sub

怎样使用VBA随心所欲显示图表类型

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

怎样使用VBA随心所欲显示图表类型
© 手抄报圈