Magnifying Dropdowns lists

HappyChappy

Active Member
Joined
Jan 26, 2013
Messages
378
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
The following code was given to me by Member Yongle and it works great on a single column

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 4 Then ActiveWindow.Zoom = 130 Else ActiveWindow.Zoom = 65
End Sub

Can it be altered to cover multiple columns and also one for just acting on a single cell
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Single cell...
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 4 Or Target.Address = "$H$9" Then ActiveWindow.Zoom = 130 Else ActiveWindow.Zoom = 65
End Sub
 
Upvote 0
That's great can it work on more than 1 column I have 4 columns with drop downs in them
 
Upvote 0
....and, as long as you only want to do a few more columns, one "schoolboy" way to do it would be to just add the others in, thus:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

With Target
    If .Column = 4 Or .Column = 5 Or .Column = 10 Or Target.Address = "$H$9" Then ActiveWindow.Zoom = 130 Else ActiveWindow.Zoom = 65
End With
End Sub
I'm sure that there's a neater way to iterate through other columns, but this'll do the trick.
Obviously, change the column numbers, to suit.
 
Upvote 0
Pleasure!
Presumably, you can see that in order to add more columns, you can just add more of the same syntax that I've already used.
What I was saying was, that to add quite a few more, there are much neater ways of doing it - like using an array, for example, but I thought that this would just get you going for now.
 
Upvote 0
Try this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Modified  3/12/2020  4:01:33 AM  EST
    Select Case Target.Column
Case "4", "5", "10"
ActiveWindow.Zoom = 130
Case Else
ActiveWindow.Zoom = 65
End Select
If Target.Address = "$H$9" Then ActiveWindow.Zoom = 130
End Sub
 
Upvote 0
Not sure who your talking to. Someone sent you a video?
Did you try my script?
 
Upvote 0

Forum statistics

Threads
1,215,972
Messages
6,128,016
Members
449,414
Latest member
sameri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top