Zoom in on sheet when a specific range is selected

Ease of Use


Version tested with


Submitted by:



Click on a certain cell (defined in the code) and the sheet is zoomed in on. 


You wish to be sure someone can read what is in a cell on on the worksheet. When they click on the highlighted cell, the entire sheet is zoomed in to 120 percent. You can change the range and the percentage of zoom in the code. When they click off of the range the sheet is returned to 100 percent(can also be managed in the code). 


instructions for use


Put this code In the module For the sheet you wish For it To work on: Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'Select the range that will activate the code If Target.Address = "$A$2" Then 'If the range is selected then zoom to 20 percent larger 'To zoom 40 percent larger change the 6 to a 7 'in the two ActiveWindow.zoom lines below 'the numbers represent a ratio-6 is 20 percent larger than 5 'and 7 is 40 percent larger than 5, etc. 'you could even use 2/1 and 1/2 to get 200 percent and back ActiveWindow.Zoom = ActiveWindow.Zoom * 6 / 5 [A5000] = "zoomed" ElseIf [A5000] = "zoomed" Then 'Otherwise set the zoom to original ActiveWindow.Zoom = ActiveWindow.Zoom * 5 / 6 [A5000].ClearContents End If End Sub

How to use:

  1. Right click on the sheet tab you wish to add the code to.
  2. Click on "View Code"
  3. This will open the VBE to the code module for the sheet.
  4. In the module pane paste the code above.
  5. Close the Visual Basic Editor by clicking the X in the upper right corner or go to File-Close

Test the code:

  1. Click on the cell or range you have selected in your code.

Sample File:

ZoomSheetWhenSpecificCellSelected.zip 6.85KB 

Approved by mdmackillop

This entry has been viewed 247 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2014 VBA Express