Hello forum! I have a challenge that I need help with concerning VBA and sheet protection. I have created Data Validation Drop Down Menus in a Worksheet to allow selection from certain lists stored in another sheet. Initially, the font of the options in the drop down menu list was extremely small. I entered the following VBA formula to auto zoom when these cells were selected and return to normal zoom when any other cell was selected:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngDV As Range
Dim intZoom As Integer
Dim intZoomDV As Integer
intZoom = 50
intZoomDV = 85
Application.EnableEvents = False
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo errHandler
If rngDV Is Nothing Then GoTo errHandler
If Intersect(Target, rngDV) Is Nothing Then
With ActiveWindow
If .Zoom <> intZoom Then
.Zoom = intZoom
End If
End With
Else
With ActiveWindow
If .Zoom <> intZoomDV Then
.Zoom = intZoomDV
End If
End With
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
GoTo exitHandler
End Sub
I protected other formula containing cells in the workbook and protected the sheet. Now the VBA isn't able to execute and I once again have extremely small font when I try to select from the drop down menus. Does anyone have a fix for this?
Thanks for the help!
Bookmarks