View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ndel40 Ndel40 is offline
external usenet poster
 
Posts: 17
Default Tab Code Retrieve a Value

Im using tab code to zoom in on a cell when it is selected. Once the user
leaves the zoomed cell, I would like to return to the previous value of the
zoom property before it was set to 120.

For example€¦ the user is in cell A1 and they set the zoom value to 75. They
then select cell O22 and the zoom value is automatically set to 120. When
the leave cells O22, I would like to have the value of zoom set back to 75.

I realize I could set this manually with ActiveWindow.Zoom = 75, however,
most users have different zoom preferences, so I would like it to go back to
what they had set.

My code is below...

Thanks

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim a As Integer

a = ActiveWindow.Zoom
Range("a1").Value = a


If Target.Address = "$O$22" Then
ActiveWindow.Zoom = 120

ElseIf Target.Address = "$D$9:$E$9" Then
ActiveWindow.Zoom = 120

ElseIf Target.Address = "$C$19" Then
ActiveWindow.Zoom = 120

ElseIf Target.Address = "$C$21" Then
ActiveWindow.Zoom = 120

Else
ActiveWindow.Zoom = a
End If
End Sub