Pinterest Pixel

Change Chart Type Using Macros In Excel

Bryan
Manually switching chart types in Excel used to be one of those repetitive tasks that slowly drove me up the wall—clicking through menus just to turn a column chart into a line chart, again and again, across multiple sheets.
It was tedious, error-prone, and a complete productivity killer.

Manually switching chart types in Excel used to be one of those repetitive tasks that slowly drove me up the wall—clicking through menus just to turn a column chart into a line chart, again and again, across multiple sheets. It was tedious, error-prone, and a complete productivity killer.

That changed the day I started using macros. With just a few lines of VBA, I automated the whole process—no more endless clicking or copy-pasting formats. In this article, I’ll show you exactly how to change chart type using macros effortlessly. I’ll share working code, tips I learned from trial and error, and how this small trick saved me big time in real-world projects. If you’re ready to make Excel work smarter, not harder, let’s dive in.

Key Takeaways:

  • Macros save time by eliminating the need to manually change chart types over and over again.
  • A few lines of VBA code can turn a repetitive task into a one-click solution.
  • Interactive dashboards are easier to build when macros are used to switch between chart types dynamically.
  • Enabling the Developer tab is the first step to writing and running chart-related macros in Excel.
  • Chart types can be customized within the code using Excel’s full list of supported chart constants.

Change Chart Type Using Macros In Excel | MyExcelOnline

Download excel workbookChange-Chart-Type.xlsm

Why Automate Chart Type Changes in Excel

Save Time on Repetitive Tasks

Back in the day, when I had to prepare weekly reports, I used to click through chart options endlessly to switch from a column chart to a line or pie chart, just to compare visual impact. It wasn’t just annoying — it was inefficient. Using macros, I now automate the whole process with a single click. That means less time formatting and more time analyzing.

In Excel, if you’re constantly switching chart types for similar data sets — say, sales numbers, trend lines, or category-wise breakdowns — writing a macro can drastically reduce repetitive formatting work. It’s like setting up a coffee machine to deliver your morning espresso exactly the way you like it. Do it once, enjoy it forever.

Make Dashboards More Interactive

I love building dashboards in Excel, but I also know static visuals can get stale fast. With macros, I create buttons that let users switch between chart types on the fly — from column to line, to pie, to combo charts. It adds a layer of interactivity that makes the dashboard feel more dynamic and alive.

Macros allow you to change the chart type based on user inputs or predefined conditions. That’s a level of customization that’s tough to beat when presenting to clients or team leads who love data… but hate static charts.

Step by Step Guide: Change Chart Type Using Macros in Excel

Enable the Developer Tab

If the Developer tab isn’t visible on your Excel ribbon:

STEP 1: Go to File > Options.

Change Chart Type Using Macros In Excel

STEP 2: Select Customize Ribbon. On the right, check the box for Developer. Click OK.

Change Chart Type Using Macros In Excel

Done! The Developer tab will now appear on your ribbon.

Change Chart Type Using Macros In Excel

Write VBA Code

STEP 1: Go to Developer > Code > Visual Basic

Change Chart Type Using Macros In Excel

STEP 2: Paste in your code and Select Save.

'Select your chart first before running this
Sub ChangeChartType()
'This is the clustered column chart, you can change the type
'Other chart types are listed at: https://docs.microsoft.com/en-us/office/vba/api/Excel.XlChartType
ActiveChart.ChartType = xlColumnClustered
End Sub

You can change the chart type in the code to the type you prefer. The list of chart types are listed here.

Close the window afterwards.

Change Chart Type Using Macros In Excel

STEP 3: Let us test it out!

Open the sheet containing the chart. Go to Developer > Code > Macros

Change Chart Type Using Macros In Excel

Make sure your chart and macro are selected. Click Run.

Change Chart Type Using Macros In Excel

With just one click, your chart type is now changed!

Change Chart Type Using Macros In Excel

 

Common Use Cases

  • Recurring Weekly or Monthly Reports – If you’re building sales, marketing, or financial reports on a regular basis, chances are you’re formatting similar charts over and over. Using a macro to change chart types can shave off several minutes — even hours — over time. I’ve used it to instantly switch from column to line charts to highlight trends better in meetings. It’s one of those small tweaks that brings big-time efficiency.
  • Dynamic Dashboards for Clients or Teams – Interactive dashboards are a hit in any organization, but most users don’t want to mess with the chart formatting. By assigning macros to buttons, I let others switch chart types with a click — no Excel expertise needed. This is incredibly useful when stakeholders want to view data in different ways depending on context. It feels like app-level functionality without ever leaving Excel.
  • Comparing Visual Impact of Different Chart Types – Sometimes you don’t know whether a line chart or bar chart will better showcase your data until you see both. With macros, I can quickly cycle through various chart types and instantly judge which one communicates the story more effectively. It saves me the hassle of recreating or copying charts just for comparison. This is a real win for visual data storytelling.
  • Teaching or Presenting Excel in Workshops – When training teams on Excel or running demos, switching chart types manually can interrupt flow and kill momentum. I’ve used chart-changing macros during live sessions to show the impact of different visuals in seconds. It keeps the session dynamic and interactive — and the “Wow, how did you do that?!” reactions are always a bonus.

FAQs

1. Do I need to know programming to use these macros?

Not at all. You don’t need any prior coding experience to use a macro for changing chart types in Excel. The process mainly involves copying a ready-made script into the Visual Basic Editor and making minor tweaks, like changing the chart type constant. The syntax is straightforward, and Excel handles the execution. Once saved, the macro can be run with a single click — no debugging or coding expertise required.

2. What if I have more than one chart on my sheet?

If your worksheet contains multiple charts, relying on ActiveChart can be risky because it only targets the chart that’s currently selected. To avoid errors, you can reference each chart explicitly using ChartObjects(“Chart Name”), which targets a specific chart by name. For broader control, you can loop through all charts using a For Each loop and apply changes programmatically. This ensures consistent results across multiple charts and is ideal for dashboard automation.

3. Can I assign a macro to a button for easier access?

Yes, you can easily assign your macro to a button in Excel to make chart switching more user-friendly. Simply go to the Developer tab, insert a Form Control button, and link it to your macro using the “Assign Macro” option. This setup allows anyone — even non-technical users — to click a button and change chart types without opening the code editor. It’s perfect for making dashboards more interactive and polished.

4. Will changing chart types with a macro affect data or formatting?

Macros that change chart types won’t alter your data, but they can affect certain formatting elements. For instance, switching from a column chart to a pie chart might reposition labels or hide axis values. Font styles and colors usually remain the same, but chart-specific settings may reset. It’s a good idea to test the macro on a copy of your chart to ensure the layout still looks the way you want after the change.

5. What chart types can I use in VBA macros?

VBA supports a wide variety of chart types such as xlColumnClustered, xlLine, xlPie, xlBarClustered, and xlXYScatter. You can modify the chart type in your macro simply by replacing the chart constant. Microsoft provides an official list of all supported chart types along with their corresponding constants. Once you’re familiar with them, switching between chart styles becomes fast, flexible, and highly customizable.

If you like this Excel tip, please share it



Change Chart Type Using Macros In Excel | MyExcelOnline


Bryan

Bryan Hong is an IT Software Developer for more than 10 years and has the following certifications: Microsoft Certified Professional Developer (MCPD): Web Developer, Microsoft Certified Technology Specialist (MCTS): Windows Applications, Microsoft Certified Systems Engineer (MCSE) and Microsoft Certified Systems Administrator (MCSA).

He is also an Amazon #1 bestselling author of 4 Microsoft Excel books and a teacher of Microsoft Excel & Office at the MyExecelOnline Academy Online Course.

See also  Create a Table of Contents Using Macros In Excel

Star 30 Days - Full Access Star

One Dollar Trial

$1 Trial for 30 days!

Access for $1

Cancel Anytime

One Dollar Trial
  • Get FULL ACCESS to all our Excel & Office courses, bonuses, and support for just USD $1 today! Enjoy 30 days of learning and expert help.
  • You can CANCEL ANYTIME — no strings attached! Even if it’s on day 29, you won’t be charged again.
  • You'll get to keep all our downloadable Excel E-Books, Workbooks, Templates, and Cheat Sheets - yours to enjoy FOREVER!
  • Practice Workbooks
  • Certificates of Completion
  • 5 Amazing Bonuses
Satisfaction Guaranteed
Accepted paymend methods
Secure checkout

Get Video Training

Advance your Microsoft Excel & Office Skills with the MyExcelOnline Academy!

Dramatically Reduce Repetition, Stress, and Overtime!
Exponentially Increase Your Chances of a Promotion, Pay Raise or New Job!

Learn in as little as 5 minutes a day or on your schedule.

Learn More!

Share to...