Generally, charts will make it easier to understand any data or information. Because it shows the information in a creative and attractive way. Excel charts option has many chart types, and they are unique. In this tutorial, we are going to see how to change chart type using Macros (VBA) in Excel Office 365. You just follow the steps given below and convert the type of chart that you have in your Excel worksheet.
Change Chart Type using Macros:
To convert the chart type in Excel, you need to follow the below instructions.
- The below-given screenshot has shown the example bar chart, and we are going to change it to a Pie chart.
- On the Developer Tab, select the Visual Basic option under the Code section.
- Then you need to copy and paste the code given below.
VBA code to convert Chart type using Macros
‘Select your chart
Sub ApplyPieChart()
‘This is the bar chart, you can change the type
ActiveChart.ChartType = xlPie
End Sub
- You need to save the code by selecting it. Then close the window.
- You have to open the sheet containing the data. On the Developer Tab, choose the Macros option in the Code section.
- You need to make sure that your macro is selected and click the Run button.
- Now, you will see that the selected bar chart has been changed into a Pie chart as shown in the below image.
Summary:
In this tutorial, we guided you to know the steps to change chart type using Macros (VBA) in Excel Office 365. Drop your queries/suggestions in the below comment section. Thanks for visiting Geek Excel. Keep Learning!
Top comments (0)