GeorgeWhite
New Member
- Joined
- Apr 20, 2017
- Messages
- 27
I am looking for some help to add too the following code
I have noticed some users deleting and typing there own text into Cell "C11" and although the data validation shows an error the code then goes into a "Run-time error". Does anyone know a way I could bypass this? I was thinking maybe locking the worksheet and leaving Cell "C11" as unlocked then using VBA to prevent the user from doing anything but use the mouse to select the drop down?
Code:
Private Sub Worksheet_Change(ByVal Target As Range) Dim ws As Worksheet
Dim rng As Range
Set rng = Range("C11")
If Target.Address = rng.Address Then
For Each ws In Worksheets
Select Case UCase(ws.Name)
Case "MENU", UCase(rng.Value)
ws.Visible = xlSheetVisible
Case Else
ws.Visible = xlSheetVeryHidden
End Select
Next ws
Sheets(rng.Value).Select
End If
End Sub