Zoom into Spreadsheet on Double-Click

June 15, 2009 by datapig Leave a reply »

Does this look familiar? I affectionately call it the eye-chart.

It’s the monster spreadsheet that’s been passed down through multiple generations of analysts – analysts who probably need lasek surgery now.

Here’s a down and dirty technique you can use when you find you’re constantly zooming in and out, alternating between scanning large sections of data and reading specific cells.

Go to the Visual Basic Editor (you can press Alt+F11 to get there) and put this code into the SheetBeforeDoubleClick event of the Workbook.

If ActiveWindow.Zoom <> 100 Then
ActiveWindow.Zoom = 100
Else
ActiveWindow.Zoom = 200
End If


With this in place, you can double-click on a cell in the spreadsheet to zoom in 200%. Double-click again and excel zooms back to 100%.

Obviously, you can change the values and complexity in the code to fit your needs.


This screenshot proves that I zoomed in (in case you didn’t believe me).

Extra Tip: Double-Clicking with your middle finger helps moral when dealing with super-annoying spreadsheets.

RELATED STUFF

  1. Using Arrows to Edit a Named Range
  2. Outta My Way Formula Thingy!
Advertisement

15 Responses

  1. dermotb says:

    I like that.

  2. Nick Partridge says:

    Is this 2007 only? It does not seem to work in 2003.

  3. jaymz says:

    2003 absolutely can

  4. DataPig says:

    This seems to work for me in 2003

  5. If like me you always have a finger on CTRL and the other on the mouse. You can scroll the wheel on the mouse while pressing CTRL.

    It also works in IE8, Word and probably many others.

  6. DataPig says:

    Very true Sebastien. Thanks for pointing that out.

    But double-clicking does require only one finger ; )

  7. It does not work in 2003.
    The dblclick event is never fired. Is there a specific place in which should I click? Guess not, just in a cell.

  8. datapig says:

    Francesco: Make sure you’re placing the code in the SheetBeforeDoubleClick event. It works for me in 2003.

  9. UpRider says:

    If ActiveWindow.Zoom 100 Then
    ActiveWindow.Zoom = 100
    Else
    ActiveWindow.Zoom = 200
    End If
    Sendkeys “{ESC}”

    Adding the last line above will exit from the edit mode if the cursor is left in the selected cell blinking, so that things don’t hang up.

  10. DataPig says:

    UpRider: Great tip!

  11. Omar says:

    UpRider, unfortunately the Sendkeys line didn’t work for me. First, I had a compile error, which I bypassed by changing the line to:

    vba.sendkeys “{ESC}”

    Now, it doesn’t have any effect. Oh well.

  12. Jimbo213 says:

    if you save this in PERSONAL.XLS it will be available for every workbook you use.

  13. DataPig says:

    Jimbo:Great point!

  14. Trainee says:

    Thank-you for the intel. I’ve always used two hands – thumb wheel on mouse plus Ctrl key- allows variable zoom in and out. Also, will keep the selected cell in the viewing screen at any percent.

Leave a Reply

Leave a Reply

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

*

* Copy this password:

* Type or paste password here:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>