VBA code to zoom out when an option is selected on a data validation list

%3CLINGO-SUB%20id%3D%22lingo-sub-2256655%22%20slang%3D%22en-US%22%3EVBA%20code%20to%20zoom%20out%20when%20an%20option%20is%20selected%20on%20a%20data%20validation%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2256655%22%20slang%3D%22en-US%22%3E%3CP%3EI%20find%20the%20small%20font%20size%20when%20using%20data%20validation%20annoyingly%20small%20as%20I%20am%20usually%20on%2070%25%20zoom.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20found%20the%20following%20vba%20code%20which%20automatically%20zooms%20in%20when%20a%20dropdown%20list%20is%20selected%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3EPrivate%20Sub%20Worksheet_SelectionChange(ByVal%20Target%20As%20Range)%0A%0ADim%20KeyCells%20As%20Range%0ASet%20KeyCells%20%3D%20Range(%22DropDown%22)%0A%20%20%20%20If%20Not%20Application.Intersect(KeyCells%2C%20Range(Target.Address))%20_%0A%20%20%20%20%20%20%20%20%20%20%20Is%20Nothing%20Then%0A%0AActiveWindow.Zoom%20%3D%20100%0A%0AEnd%20If%0A%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20help%20to%20write%20some%20code%20that%20automatically%20changes%20the%20zoom%20to%2070%25%20once%20a%20drop%20down%20value%20has%20changed%20if%20possible%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2256655%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

I find the small font size when using data validation annoyingly small as I am usually on 70% zoom.

 

I have found the following vba code which automatically zooms in when a dropdown list is selected:

 

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim KeyCells As Range
Set KeyCells = Range("DropDown")
    If Not Application.Intersect(KeyCells, Range(Target.Address)) _
           Is Nothing Then

ActiveWindow.Zoom = 100

End If

End Sub

 

I would like help to write some code that automatically changes the zoom to 70% once a drop down value has changed if possible?

 

 

1 Reply

@DBreezy92 

Try this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim dv As XlDVType
    On Error Resume Next
    dv = ActiveCell.Validation.Type
    On Error GoTo 0
    If dv = xlValidateList Then
        ActiveWindow.Zoom = 100
    Else
        ActiveWindow.Zoom = 70
    End If
End Sub