Results 1 to 12 of 12

VBA Code to Zoom Data Validation Drop Down Menu Won't Work in Protected Sheet

Threaded View

  1. #1
    Registered User
    Join Date
    10-25-2017
    Location
    Texas, United States
    MS-Off Ver
    Excel 2016
    Posts
    18

    Question VBA Code to Zoom Data Validation Drop Down Menu Won't Work in Protected Sheet

    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!
    Last edited by EFD; 10-25-2017 at 10:18 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 04-19-2017, 03:51 PM
  2. Replies: 4
    Last Post: 10-28-2015, 12:59 PM
  3. How to run code automatically every time a drop-down validation menu changes
    By elgatnegre in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2014, 04:45 PM
  4. ComboBox/Data Validation won't work when sheet is protected.
    By Butler82Paul in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-12-2013, 11:38 AM
  5. Replies: 6
    Last Post: 07-02-2013, 05:23 AM
  6. Replies: 1
    Last Post: 05-15-2013, 01:55 PM
  7. Replies: 0
    Last Post: 06-28-2012, 01:08 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1