thattallredhead
New Member
- Joined
- Oct 4, 2023
- Messages
- 1
- Office Version
- 2016
- Platform
- Windows
I'm super basic when it comes to excel - I figured out (from this website btw, how to add code to my excel doc that enables someone to select multiple drop downs. HOWEVER, once I locked the form, it's not allowing me to select multiple drop downs, only 1.
I copied the code here from the website because again, newbie here, so I'm wondering what I would need to update in the code specifically to allow for multiple drop down selections in a protected sheet.
PLEASE HELP!
I also tried to download and use the XL2BB add in but it will only paste in the excel form, not the code. again - I have no idea what I'm doing. So I'm going to paste it in here and an image of it.
Option Explicit
Private Sub Worksheet_Change(ByVal Destination As Range)
Dim DelimiterType As String
Dim rngDropdown As Range
Dim oldValue As String
Dim newValue As String
DelimiterType = ", "
If Destination.Count > 1 Then Exit Sub
On Error Resume Next
Set rngDropdown = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitError
If rngDropdown Is Nothing Then GoTo exitError
If Intersect(Destination, rngDropdown) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newValue = Destination.Value
Application.Undo
oldValue = Destination.Value
Destination.Value = newValue
If oldValue = "" Then
'do nothing
Else
If newValue = "" Then
'do nothing
Else
Destination.Value = oldValue & DelimiterType & newValue
' add new value with delimiter
End If
End If
End If
exitError:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
I copied the code here from the website because again, newbie here, so I'm wondering what I would need to update in the code specifically to allow for multiple drop down selections in a protected sheet.
PLEASE HELP!
I also tried to download and use the XL2BB add in but it will only paste in the excel form, not the code. again - I have no idea what I'm doing. So I'm going to paste it in here and an image of it.
Option Explicit
Private Sub Worksheet_Change(ByVal Destination As Range)
Dim DelimiterType As String
Dim rngDropdown As Range
Dim oldValue As String
Dim newValue As String
DelimiterType = ", "
If Destination.Count > 1 Then Exit Sub
On Error Resume Next
Set rngDropdown = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitError
If rngDropdown Is Nothing Then GoTo exitError
If Intersect(Destination, rngDropdown) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newValue = Destination.Value
Application.Undo
oldValue = Destination.Value
Destination.Value = newValue
If oldValue = "" Then
'do nothing
Else
If newValue = "" Then
'do nothing
Else
Destination.Value = oldValue & DelimiterType & newValue
' add new value with delimiter
End If
End If
End If
exitError:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub