I have a worksheet with multiple drop down lists that allow for multiple selections. The sheet loses this functionality when I protect the sheet. I need to keep the sheet protection as the document is going to be utilized by many people. I don't want them all making changes.
How can I fix the code below to ensure the sheet protection is in place but the multiple selection drop down lists also work. Thanks in advance.
There may be another way to do it but I find protecting a sheet without using any password is ideal for this sort of scenario.
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Target.Address = "$C$10" Or Target.Address = "$C$16" Or Target.Address = "$C$17" Or Target.Address = "$C$19" Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
Else
If InStr(1, Oldvalue, Newvalue) = 0 Then
Target.Value = Oldvalue & ", " & Newvalue
Else:
Target.Value = Oldvalue
End If
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
How can I fix the code below to ensure the sheet protection is in place but the multiple selection drop down lists also work. Thanks in advance.
There may be another way to do it but I find protecting a sheet without using any password is ideal for this sort of scenario.
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Target.Address = "$C$10" Or Target.Address = "$C$16" Or Target.Address = "$C$17" Or Target.Address = "$C$19" Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
Else
If InStr(1, Oldvalue, Newvalue) = 0 Then
Target.Value = Oldvalue & ", " & Newvalue
Else:
Target.Value = Oldvalue
End If
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub