Change Chart Type using Macros (VBA) in Excel Office 365!!
Tags: changecharttypeusing, vbamacros
Published: 2021-02-09 11:58:05

---
title: Change Chart Type using Macros (VBA) in Excel Office 365!!
published: true
date: 2021-02-05 05:32:13 UTC
tags: Changecharttypeusing,VBAMacros
canonical_url: https://geekexcel.com/change-chart-type-using-macros-vba-in-excel-office-365/
---

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](https://geekexcel.com/excel-charts-types-in-office-365/) 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](https://geekexcel.com/excel-office-365-vba-overview-definition-and-examples/)) 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](https://geekexcel.com/change-chart-type-excel/), you need to follow the below instructions.

- The below-given screenshot has shown the example [bar chart](https://geekexcel.com/create-bar-charts-in-excel-office-365-simple-easy-steps/), and we are going to change it to a [Pie chart](https://geekexcel.com/create-a-pie-chart-in-excel-office-365-with-easy-example/).

![Example chart](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_s9nKiWb5WC.png)<figcaption id="caption-attachment-21650">Example chart</figcaption>

- On the **Developer Tab, select** the **Visual Basic** option under the **Code** section.

![Select Visual Basic option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Select-Visual-Basic-option-5.png)<figcaption id="caption-attachment-14839">Select the Visual Basic option</figcaption>

- 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.**

![Save the code](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_N3qB14uICw.png)<figcaption id="caption-attachment-21651">Save the code</figcaption>

- You have to open the sheet containing the data. On the **Developer Tab, choose** the **Macros option** in the **Code** section.

![Choose the Macros option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Choose-the-Macros-option-3.png)<figcaption id="caption-attachment-14841">Choose the Macros option</figcaption>

- You need to make sure that your macro is selected and **click** the **Run** button.

![Click the Run button](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_DUdLR3JJb5.png)<figcaption id="caption-attachment-21652">Click the Run button</figcaption>

- Now, you will see that the selected bar chart has been changed into a **Pie chart** as shown in the below image.

![Output](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_nlt4rL5rtJ.png)<figcaption id="caption-attachment-21653">Output</figcaption>

## Summary:

In this tutorial, we guided you to know the steps to **change chart type using Macros** ([VBA](https://geekexcel.com/excel-office-365-vba-overview-definition-and-examples/)) in Excel Office 365. Drop your **queries/suggestions** in the below comment section. Thanks for visiting **[Geek Excel.](https://geekexcel.com/)** Keep Learning!

### Keep Reading:

- [Change the Chart Type in Excel Office 365 ~ With Clear-Cut Examples!!](https://geekexcel.com/change-chart-type-excel/)
- [Create a Table of Contents using Macros (VBA) in Excel Office 365!](https://geekexcel.com/create-a-table-of-contents-using-macros-vba-in-excel-office-365/)