exceljockey
Member
Hi
I am pretty new to writing code. I am trying to achieve something on my dashboard.
The Logic goes as follows: If Cells B4,C4, or D4 are selected, then zoom in 120%. If cells T3 or T15 are selected, then zoom in 120% AND scroll right 15 columns. If cells B17 or B30 are selected, then zoom in 120% AND scroll down 15 rows. If ANY OTHER cells are selected, then zoom out to 70% & scroll 1 column, and 1 row (To reset position of the dashboard).
The code I have made is:
[pre]
[/pre]
Now This works for zooming in, but I don't know how to split the code up so that it does separate things for separate cells selected (as described in the logic).
Any help, or pointers, would be very much appreciated!
Thanks,
EJ
I am pretty new to writing code. I am trying to achieve something on my dashboard.
The Logic goes as follows: If Cells B4,C4, or D4 are selected, then zoom in 120%. If cells T3 or T15 are selected, then zoom in 120% AND scroll right 15 columns. If cells B17 or B30 are selected, then zoom in 120% AND scroll down 15 rows. If ANY OTHER cells are selected, then zoom out to 70% & scroll 1 column, and 1 row (To reset position of the dashboard).
The code I have made is:
[pre]
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B4,C4,D4,E4,B17,B30,T3,T15")) Is Nothing Then
ActiveWindow.Zoom = 70
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
Else
ActiveWindow.Zoom = 120
End If
End Sub
Now This works for zooming in, but I don't know how to split the code up so that it does separate things for separate cells selected (as described in the logic).
Any help, or pointers, would be very much appreciated!
Thanks,
EJ