When you have a dashboard with small panel charts it is nice to be able to zoom in on the charts to see the trends better. The ‘Zoom_Chart' macro included in the workbook allows you to add a zoom button (shape) over the top left corner of the chart to zoom in on the chart. It's available for free download below. The macro actually resizes the chart to enlarge it, then returns it to it's original size when the zoom button is pressed again. See the animated screen capture below.
You can control the zoom amount by changing the percentage values for Zoom Width and Zoom Height in cells P5:P6 on the worksheet. These can also be hardcoded in the code if you don't want the user to change the size of the zoom.
Video Overview & Basic Tutorial
The video above contains a detailed tutorial on how to add the zoom buttons to your own workbook. It's really a matter of copying and pasting the macro (VBA code) and buttons into your workbook, and then assigning the macro to the buttons. You should still be able to implement this even if you aren't familiar with VBA or macros. It is important to line up the buttons on the chart correctly and give each button a unique name. So it's best to watch the video to make sure you don't miss anything. The steps covered in the video are listed below.
The zoom feature works really well with dashboards and reports where your screen area is limited. If you would like to learn more about charting and dashboards I highly recommend the dashboard course from My Online Training Hub. Checkout my full video review of the course and learn how to become an Excel Superhero! 🙂
- Open the Zoom on Charts workbook and your workbook.
- Open the VBA Editor and drag & drop the code module into your workbook.
- Save your file as a macro enabled workbook.
- Copy the zoom button into your workbook.
- Place the zoom button on the top left corner of a chart.
- Assign the macro to the button.
- Change the zoom references in the code.
- Duplicate the zoom button.
- Give the button a unique name.
The VBA can be further enhanced to add data labels, legends, axis labels, and any additional chart components when the zoom in button is pressed. Please leave a comment with some of the enhancements you made, or would like to see.
Zoom on Excel Charts.xls (82.9 KB)
Zoom on Excel Charts - Bottom Right.xls (84.5 KB)
Zoom On Excel Charts - Top Right.xls (85.0 KB)
The “Bottom Right” file contains modified code that allows you to place the zoom button in the bottom-right corner of the chart. The chart zooms from the bottom-right and expands up and to the left. Zooming from the top-left or bottom-right are the only two options for button placement with this code.
The “Top Right” file contains code that allows you to place the zoom button in the top-right corner of the chart. This option can cause problems if the chart is too close to column A and tries to expand beyond the left side of the worksheet. The location of the chart will move and the chart will need to be manually resized and moved back to align with the zoom button.
Please leave a comment below with any questions or modifications you have made.