Zoom on Excel Charts

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.

Zoom on Excel Charts
Zoom on Excel Charts with VBA Macro

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.

Installation Guide

  1. Open the Zoom on Charts workbook and your workbook.
  2. Open the VBA Editor and drag & drop the code module into your workbook.
  3. Save your file as a macro enabled workbook.
  4. Copy the zoom button into your workbook.
  5. Place the zoom button on the top left corner of a chart.
  6. Assign the macro to the button.
  7. Change the zoom references in the code.
  8. Duplicate the zoom button.
  9. 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.


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.


Your email address will not be published. Required fields are marked *

  • jon,

    i was the one that requested this function but i have a problem with the zoom icon? where did you get the icon? also, i would like the ability to add data labels and chart components. I am not a vba expert but need your help since i think this is an excellent tool especially for someone like me who do alot of charts for analysis.

    if you can provide me a video tutorial, i would appreciate it.


    • The icon is actually a circle shape that contains text. The text is the “+” and “-” sign. So you can actually change all the properties of the shape (color, size, text, font, etc.) to suit your needs. Is the problem with the icon just the look of it?

      I will create a video tutorial and add the additional functionality.

      Thanks again,

  • Jon,

    the code you gave me for the zoom function, when i copy and paste it in the visual basic editor and changed the name of the button, i get an object error message. all i did was copy and paste the exact same code in the specified sheet where the charts are located. I did not create a module and copy and paste it in there

    please let me know what i need to do to fix it. i am trying to learn VBA.


    • The code needs to be pasted in a module in the workbook. To create a module, select the VBAProject for your file in the Project Explorer window on the left side. Right click it and select Insert > Module. Double click on the newly created module to open it, and paste the code there. Then you will need to assign the zoom buttons to the newly created macro. Right click on the button and select Assign Macro… Select Zoom_Chart from the list.

      I’m working on creating an instructional video for implementing this.


  • […] This is a simpler solution for adding a zoom button (shape) to your chart to enlarge the chart for easier viewing. Works great with panel charts or sparklines on a dashboard. You can download the workbook containing the macro and instructions for free at Zoom on Excel Charts | Excel Campus […]

  • It’s beautiful. Works perfectly! Thanks Jon.
    Wanted to check, if there is a way to zoom it in any direction that we want?
    For eg: Some times the graphs may be at the extreme right side, and hence the chart may zoom, but to the left side. Also, the zoom button may need to move to the top left hand corner of the zoomed graph.


    • Thanks Sriram! Zooming to the left is a little more complicated, but possible.

      The macro uses the “TopLeftCell” property of the chart object to determine which button is being pressed on the sheet. Unfortunately, there is no “TopRightCell” property to do the same procedure for the top right cell. If there was, then we could use that and change the scalewidth method to scale from the bottom right.

      There are two possible workarounds that I can think of:

      1. Create a unique copy of the Zoom_Chart code, modify it to zoom to the right, and assign it directly to the button. In the new copy of the code you would not need to find the cell (top left) that the chart and button intersect. Instead, you would just reference the name of the chart in the code. The button could then be placed anywhere on the chart or outside of it. The only drawback to this is that you have to have a unique code procedure for each button. It really won’t add much size to your file, just more code to maintain.

      2. You could also make the sheet scroll to the right when the button is pressed by using the application.goto method to move the horizontal or vertical scroll to the right. This is probably not the best method because you will be scrolling the other charts off the screen.

      My explanations above assume that you have some knowledge of modifying the code. Let me know if you are interested in either of these solutions, but not sure how to implement it. I’d be happy to help.


      • hey Jon,
        thanks for this awesome macro.

        can u plz help me with right zoom.
        can you give the syntax for right zoom

      • Hi Jon,

        I appreciate that it has been a few years since you were responding to people on here but on the off chance that you are still about, I could do with your help with trying to implement this function but for the top right of a chart, rather than the easier top left.

        I am “OK” with VBA but not good enough to start coding away on my own.

        If it possible for you to help me at all?

        The formats can stay the same with the + / – etc, its just the zoom to the left rather than the right as it is now.

        Also, need to say, this is the best bit of coding that I have seen in a long time! Zooming in charts is not only helpful but looks awesome when presenting information directly to the customer!

        Thanks for any help you can provide,


        • Hi Chris,
          Thank you for the nice feedback. This is the 2nd time I have this question in the last week, so I spent some time finding a solution. I added a new file to the downloads section above named “Zoom On Excel Charts – Top Right.xls”

          This file contains the code to zoom from the top-right corner of the chart. I have not thoroughly tested, but it seems to work well. The one thing you will want to be careful of is that the chart does not expand into the left edge of the worksheet. If it does, then the chart will move and you will have to manually realign and resize it to the button. As long as you keep the zoomed chart to the right of column A you should be fine. I hope that helps. Let me know if you have any questions. Thanks!

          • Hi Jon,

            Fantastic! Thank you very much for your kindness and willingness to help us less skilled VBA lovers.

            Good point about trying to expand charts past Col A, thankfully i only plan to use the charts on the extreme right side of my ‘Dashboard’ (Col Q-W) with this golden code – no more having to scroll right to see the zoomed charts!!

            Thanks again for your help and i wish you good luck in your future endeavors.

            No doubt I will be back if i stumble across something which maybe you can help with ๐Ÿ™‚

            Kind Regards,


  • Hey Jon, your video instructions are indeed fantastic! Great job!! And most of all thanks for the valuable contribution to the excel community, at least for me it’s definitely valuable.

    However I would like to ask: If I have varying sizesof charts in a workbook, that means the chart magnification will differ. How do I assign an additional macro to those different charts?


    • Thanks Darren! I appreciate the comments and kind words, and I’m really glad you’re finding this information useful.

      There are a few ways you could accomplish the issue of having different size charts. It will probably depend on how many different sizes of charts you have. If it is just a few different sizes, then the easiest solution would be to duplicate the macro code and rename it. You could specify the zoom size in each macro, and then assign the buttons to the different macros based on the size of the chart.

      For example, let’s say you have 3 different size charts in your workbook: small, medium, large. We will need to create 3 different macros for each of these.

      1. Open the VBA editor (Alt+F11) and double click the m_ZoomCharts module to open it.
      2. Copy all the code from “Sub Zoom_Chart” to “End Sub” (including those two lines).
      3. Paste the text below the “End Sub” line at the bottom of the module.
      4. Rename the macro from “Zoom_Chart” to “Zoom_Chart_Small”.
      5. Change the zoom amounts in the “Zoom_Chart_Small” macro to the zoom amount for the small charts.
      6. Go back to your workbook and assign the “Zoom_Chart_Small” macro to the zoom buttons in the small charts.
      7. Repeats steps 2-6 above for the other chart sizes.

      An alternative method would be to modify the single procedure (macro) with a select statement that sets the zoom amount based on the button name. You would then change the button name based on the size of the charts (small, medium, large). This would require you to modify the code and possibly debug it, where the 1st suggestion above is basically copy/paste and rename.

      Let me know if you have any questions on implementing this.

      Thanks again,

      • Good morning Jon!

        Yes it does work, and I’ve managed to change it based on your instructions.

        Once again, I’m sure the good things which worked for people and helped them from the time you’ve invested to share these cool stuffs will come back to you many times greater!

        Have a great day Jon ๐Ÿ™‚


        • Comments like that keep me fueled to continue learning and sharing my knowledge. Thanks again Darren! I’m glad it worked for you. Hope you have a good one too. ๐Ÿ™‚

  • hi Jon,

    thanks for such a good trick.

    I followed all the steps you described in the above video still i am not able to zoom my chart.while debuging i can facing yellow color on this line

    strButtonName = Application.Caller

    please advise.

    Thank you

    Sonu Monga
    Chartered Accountant

    • Hi Sonu,

      This error typically means that the top left corner of the chart and the button are NOT intersecting in the same cell. This is a critical step for this macro to work properly, and I should probably add some detail to the written instructions in the article above.

      The best way to check is to select the cell behind the top left corners of the chart and button. In the image below, if I select cell B5, I can not see the left edge of the bounding box around cell B5. This means that the chart is actually intersecting cell A5 in its top left corner. So you have to move the chart and the button until you can see the bounding box in the selected cell behind the top left corner of both objects.

      Move Chart and Zoom Button - Top Left Corner Intersects Same Cell

      Let me know if you have any additional questions.


  • Jon,
    This is great stuff. Thanks so much for taking the time to put this together and share it. I stumbled on the link for your site from Mike Alexander’s website and I am looking forward to exploring it.

    • Thanks Michael! I’m really glad you are enjoying it. Sign up for the free newsletter to receive emails for new blog posts.

      Thanks again,

  • Jon,
    I downloaded your sample file, copied the module to my dashboard file, and after 2-3 modifications to your code, voila! I was able to zoom on a textbox in a new dashboard I’m building. I put help information in the textbox and now users can click the +/- to zoom in/out on the ‘help’ box. Thanks so much!

    • Hi Diana,

      Awesome! That’s a great adaptation for this code. I’m curious to know what happens to the text when the help box is zoomed out. Does it show less text, then when you click the zoom button the entire text is displayed?


      • The way I have it, the box is so small to start that I can see about 4 words (“HELP (next line) Select a client” and then when you zoom, it’s about 700% larger and you can see all of the notes I’ve entered. The font is the size I’ve selected for the box but zooming makes it large enough to read all of the text in the box.

        I uploaded a graphic so you can see what it looks like. http://sdrv.ms/1cHouEz

        Thanks again!

        • I really like that! I’ve tend to use shapes or cell comments for help menus. When I use shapes I will typically have a toggle button that shows/hides the shapes when pressed. Your solution gives it more of a “wow” factor, and also allows you to easily expand one shape at a time. Thanks for making the graphic and sharing it!!!

  • Hi JOn,

    Excellent work! it helps me a lot. the video is really clear for understanding.

    However, the double right click for copying icon seems like doesnt work for me.

    I notice the second right click in your video showing the “edit text” & “Edit point”. But I dont have that with me.

    Can you tell me how to call that out?


    • Hi Ezra,

      This step is a bit tricky. You actually need to right click on the edge of the zoom button shape. This can be difficult to do because the shape is very small.

      An alternative to this is to hold down the Ctrl key and Right-click on the shape. That will show you the properties to edit the shape, instead of the text inside it.

      Let me know if this helps.

      Thank you for the comments!


  • Hey Jon,

    This is an awesome instruction video! I really want these boxes in which you can enter your zoom value though. I kinda suck at programming. Is there an easy way to implement these boxes in my own worksheet?

    Thank you sir

    • Hi Ezra,

      Thank you for supplying a sample file, this makes it much easier to find the problem.

      The problem is that each chart in the worksheet must have a unique name. Four of the charts on the worksheet currently have the same name (Bitumen Northern, Cement Usage Northern, Logistic Northern, Agg Process). Each chart name must be changed to a unique name, just like the zoom button.

      I was not aware of this issue, and I am glad you found it!

      Thanks again and let me know if you have any questions.


  • Hey Jon,

    This is awesome! I think this is especially useful when you have a ton of different charts built into a dashboard. Often times I want to include multiple charts in one dashboard but can’t seem to fit everything within one screen.

    This should help. Thanks for taking the time to share. Next time I need this code I’ll pop by the website to pick it up.



    • Thanks Brad! I have the same issue with trying to cram everything into one screen sometimes. Especially with the use of sparkline or micro charts.

      Let me know if you think of any ways it could be enhanced.


  • Late to the party, but:

    TopRightCell = Intersect(TopLeftCell.EntireRow, BottomRightCell.EntireColumn)

    I’m thinking you could avoid the issues with finding cells and charts with the same name by putting the shape into the chart. However, the shape doesn’t seem to know which chart it is embedded in. It thinks its parent is the worksheet.

  • Of course, you could use the mouse_down event, detect if the shape is clicked on. Then if the shape’s text is “+”, make the chart larger and change “+” to “-“; if the text is “-“, shrink the chart and change “-” back to “+”.

    The shape doesn’t seem to respond to the mouse_up event, at least not in 2013.

    • Hi Jon,

      Great suggestion on the Intersect method to find the top right cell! That will come in handy.

      The mouse_down is an interesting alternative, and has got me thinking about other things you could do with it.

      Thanks for the suggestions!

  • I have been trying to find something similar to this but for it to be used upon images, could this type of macro be converted to work with images, and if so what would be required?

    • Hi Mark,

      Great question! I updated the code to work with all shapes including images. You can download the latest version above.

      For those that want to know more details, I simply replaced the word “ChartObjects” with the word “Shapes” in the code. Charts actually reside inside a shape, so the code will now work with other shapes besides just charts.

      Please let me know if you have any questions.

      • Hmm, that reminds me, since a chart is encapsulated within a shape, you can assign the resizing macro to the chart object. You can place a shape in the corner of the chart so the user knows they can click the chart to resize it, and you can toggle the shape between “+” and “-“. Since Application.Caller passes the name of the shape (chart object), not the shape itself, you need to make sure that there are no shapes with duplicate names.

        And one problem with using a shape in the chart to trigger the resizing, even if you work out the mouse events, the events do not fire until the chart is active. This would require two clicks, one more than a good design would need. (And that’s a lesson that Microsoft totally forgot while designing Excel 2007.)

  • Two charts worked fine, but when I added a third chart if I clicked on first Chart or 3rd chart they were both affected by the one zoom button. If I clicked to zoom in on 1 it worked but when I clicked on it to zoom out Chart 3 got smaller than Normal and chart one stayed expanded. click one again and the both returned to normal, and the same thing happened in reverse with 3 & 1 charts

    • Hi Rod,

      That can happen when the zoom buttons share the same name. Each zoom button must be given a unique name. Checkout step 9 (8:30) in the video and please let me know if you are still having any issues. Thanks

  • I had Copied your Button & Pasted it and changed the Name and that is what happened.I have Created My own Button and it is working ok. Thanks for your Quick reply

  • Hi Jon, i tried this code of yours and everything works well except that there is error below:

    Set rngZoom = Range(ActiveSheet.Shapes(strButtonName).TopLeftCell.Address)

    Pl. see whats wrong with it.


    • Hi Namrata,

      The button needs to be placed outside of the chart. If you select the button and the chart border is also selected, this means the button is residing inside the chart. Cut the button and paste it outside of the chart. Then move the button over the top of the chart.

      Hopefully this helps. Please let me know if you have any other questions. Thanks!

  • Really useful. I was having problems selecting the button and with renaming them consistently. I found going to Find & Select…Selection Pane… made it much easier to select the button, just highlight in the list then Ctrl+D to duplicate and also made naming mistakes easy to spot.
    I also had problems aligning the button and chart, I switched on Snap to Grid thinking it would make things easy but the button never worked using this method.

  • hi jon,

    thanks for sharing the idea, I just loved the idea. can you post the link, on how to implement the changes to vba module for new zoom button.

    thanks in advance

    • Hi Vikram,
      You shouldn’t have to change anything in the code for a new zoom button. Just duplicate the button and make sure it has a unique name, then assign the Zoom_Chart macro to it. The following line of code will determine which button was pressed, and zoom on the intersecting chart.

      strButtonName = Application.Caller

      Please let me know if you have any other questions.

  • I know you are mostly an excel Guru, but is there a comparible VBA code that will let this work with PowerPoint that you know of?

    • Hi Kathy,
      That is a great question. This code can be modified for PowerPoint. I will convert it when I get a chance. Maybe someone out there will take on the challenge and beat me to it. ๐Ÿ™‚

      The other option that might be easier to implement in PowerPoint is to use hyperlinks. You could add slides to the end of your presentation that contain the enlarged charts. Then create a “zoom button” and place it on the small chart in the presentation. Create a hyperlink on that button that links to the slide containing the enlarged chart. On that slide create a “zoom out” button that contains a hyperlink back to the slide that contains the small charts.

      It might not be as elegant, but it would be a lot easier to implement and not require any macros.

      Let me know if that makes sense. Thanks for the question!

  • Hai John.

    Great Work. It’s working perfectly. i can manage Lot of Chart in a single sheet. i requesting your help to locate the Zoom button in Top Right, Left Bottom, Top Centre and Bottom Centre. Could you please suggest where i need to change the programs.

    Awaiting you reply.

    • Hi Riyas,
      I’m glad to hear it’s working for you. That’s a great question and I’m working on a way to make the code more flexible so you can put the zoom button anywhere in the chart. I will let you know when I have a solution.

  • Hi John,
    Thank you for sharing this amazing trick! It works great unless snap to grid is on. Do you know what code change is needed to account for using snap to grid?


    • Hi Cameron,

      It should work with snap to grid on, but it might be that the chart and zoom button are not aligning in the same cell because of snap to grid. You can temporarily turn snap to grid off while aligning the chart and button, then turn it back on. Let me know if that helps. Thanks for the question!

  • Hi John,
    Thank you for the quick reply! It seems that the macro sometimes changes the TopLeftCell value of the chart if the chart was aligned with snap to grid.

    Troubleshooting example:
    ?ActiveSheet.ChartObjects(“Chart 15”).TopLeftCell.Address
    $I$5 (Before macro)
    $I$4 (After macro)

    However, one workaround is to:
    1) Align all charts with snap to grid on
    2) Turn snap to grid off
    3) Move all charts down one increment with the arrow key.

  • Hi John,

    I’m using your macro with a couple of line graphs and it works great. The only thing I’d like to add is for the axis labels to get bigger as well as the charts. Is there a way to do that?

    Thank you!

  • Thank you for your help, John. I added the line for the x-axis to the code like this:
    ‘You can make changes in the following section for zoom button text and zoom amount.
    ‘The button is a toggle and text in the shape changes after it is clicked.
    ‘The text in the shape can be changed below.
    strZoomInText = “+” ‘<-THIS CAN BE CHANGED
    strZoomOutText = "-" '<-THIS CAN BE CHANGED

    'Change the Zoom IN width and height below. Amounts are multipliers,
    'for example ZoomInWidth of 5 = 500% increase in size, 0.5 = 50% increase
    dZoomInWidth = 2.5 '<-THIS CAN BE CHANGED
    dZoomInHeight = 1.5 '<-THIS CAN BE CHANGED
    dOutWidth = 1 / dZoomInWidth 'zooms back to original size
    dOutHeight = 1 / dZoomInHeight
    ActiveChart.Axes(xlCategory).TickLabels.Font.Size = 20

    but I'm getting an error message saying "Run-time error '91': Object variable or With block variable not set.

    What am I doing wrong?

  • Jon
    I came across your macro and like it… when I use it I keep getting error
    “The item with specific name wasn’t found” and when I debug it refers to your code:
    Set rngZoom = Range(ActiveSheet.Shapes strButtonName).TopLeftCell.Address)

    The shape is intersecting at A3.

      • Hi, Jon. I’m having this same issue (Excel 2013). All 4 buttons do have unique names (Zoom1, Zoom2, etc). Any other thoughts on how to get this working?

  • Hi Jon,
    Thank you for posting this helpful macro. I have a question please. How can I make the zoom out to be in full screen?



  • Hi Jon,

    I am using your macro and it is working awesome!. I just sent it to my friend and she couldn’t use the zoom option because looks like my file wouldn’t work without your file (Zoom on Charts workbook). I also deleted your workbook from my laptop and the macro did not work anymore. ๐Ÿ™

    Am I doing something wrong?



  • John,

    I am attempting to utilize the macro in Excel 2016, but I continue to get the error:

    “The item with the specified name wasn’t found.”

    When I debug it points to the following code:

    Set rngZoom = Range(ActiveSheet.Shapes(strButtonName).TopLeftCell.Address)

    I am in the top left cell and at this point I only have one zoom button created, so the name is unique.

    Any suggestions?

  • Hi,

    I love this code. So useful when using a dashboard with smaller charts.

    I have zooming to “2” currently which makes the chart very visible, but the text on the axis remain the same size. Is it possible to have the text “expand” at the same relative amount as the chart?


  • Thanks for great approach,

    I have found, it may be allready smowhere above, but I think it move ahead this nice trick. Just make a group containing button and chart. Then you can move both at one any where and they stay working all the time.

    Realy excelent would be to modify this macro to also move zoomed chart to the middle and then back to see all even most right zoomed charts visible.

  • Hi Jon,
    I want to lock the image so that it is not edited, but I want the zoon to continue working.
    It’s possible?
    thank you.

    I have tried your code in my workbook and I have succeeded it is really great
    Thank you
    However, I need to use this for more than 5 charts on the same sheet
    Hence i have tried in your original worksheet by coping the 2nd chart and keeping the zoom+ button and tried but it is not working as desired kindly advise how to do this for multiple charts (n number of charts in the same worksheet)

    Thank you

  • Hi Jon, Is there a trick to get this to work on Sparklines? It works great on ‘normal’ charts but I cannot seem to get it to recognise a sparkline.

    Many thanks,


  • I followed the instructions, but when I click the button, I get Runtime Error – item with the specified name wasn’t found. When I click Debug, it highlights Set rngZoom = Range(ActiveSheet.Shapes(strButtonName).TopLeftCell.Address). I have ensured that each button has a unique name (Zoom1, Zoom2, Zoom3, Zoom4) and they are in the top left cell of the chart. Anyone know why this won’t work?

  • Hi Jon, loving the zoom, thank you. I have put some text boxes (for titles / labels) which don’t zoom and have disappeared when the chart is minimised again. Is there a way to include everything within the chart area? Or should I be using the standard labelling? Thank you

  • Hello Jon, I’m really struggling, the problem I have is the zoom button itself is expanding and not the chart. I really need this working for a project due in the next week – would really appreciate your help. Thanks

  • Is there anyway you can provide the macro files in the XLSX format? The xls format is blocked my by work due to security restrictions because the files are so old.

  • Has this macro been enhanced? If so, would you send me, or direct me to the link for the updated version?
    Always enjoy your interesting and clever tutorials!!

  • Hi Jon
    I would love to get these excel challenges. every bit of your tutorial is very useful for my work

  • Hi Jon
    I am trying the Zoom button and followed your step one by one but somehow I copied the + button but it does not Zoom :((

  • I have created an Image Class that will expand pictures to a predetermined size and location by clicking on them, then another click returns them to their original size and location. I keep all of the pictures in a collection to manage the entire operation. The small images have 3D rounded edges so that they look like buttons.

Generic filters
Exact matches only

Excel Shortcuts List

keyboard shortcuts list banner

Learn over 270 Excel keyboard & mouse shortcuts for Windows & Mac.

Excel Shortcuts List

Join Our Weekly Newsletter

The Excel Pro Tips Newsletter is packed with tips & techniques to help you master Excel.

Join Our Free Newsletter