Excel VBA code to create a specific level of scaling

I have a list of checked drop-down lists in Excel that cannot be read if the scale is less than 100. I checked on the Internet and fvound that I cannot change the font size with the confirmed list, so I want to set the scaling to 100.

I have code to do it as follows

Private Sub Worksheet_SelectionChange(ByVal Target As Range) ActiveWindow.Zoom = 100 End Sub 

This works and is great for people who use a scale of less than 100, but if people use a scale of more than 100, it limits the scale to 100. Is there a way to overcome this, something like the If-Else statement lines.

If the scale is less than 100, then scaling = 100; otherwise, if the scale is greater than 100 does nothing

Thanks.

+4
source share
2 answers
 If (ActiveWindow.Zoom < 100) Then ActiveWindow.Zoom = 100 End If 
+10
source

Here is a single line that will do the same:

 Private Sub Worksheet_SelectionChange(ByVal Target As Range) ActiveWindow.Zoom = Application.Max(ActiveWindow.Zoom, 100) End Sub 
+5
source

Source: https://habr.com/ru/post/1393728/


All Articles