|
|
|
|
|
|
Excel
|
Zoom in on sheet when a specific range is selected
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000
|
Submitted by:
|
lucas
|
Description:
|
Click on a certain cell (defined in the code) and the sheet is zoomed in on.
|
Discussion:
|
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).
|
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)
If Target.Address = "$A$2" Then
ActiveWindow.Zoom = ActiveWindow.Zoom * 6 / 5
[A5000] = "zoomed"
ElseIf [A5000] = "zoomed" Then
ActiveWindow.Zoom = ActiveWindow.Zoom * 5 / 6
[A5000].ClearContents
End If
End Sub
|
How to use:
|
- Right click on the sheet tab you wish to add the code to.
- Click on "View Code"
- This will open the VBE to the code module for the sheet.
- In the module pane paste the code above.
- Close the Visual Basic Editor by clicking the X in the upper right corner or go to File-Close
|
Test the code:
|
- 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 253 times.
|
|