I'm learning this as a I go but I've finally figured out the correct code to allow multiple selections from one of my drop down lists. Now, when I try selecting an item from a separate list (which I only want to be able to choose one thing), it's accepting multiple items. How do I have both working properly?
This is the code I have for my multiple selection list (which is only in column M):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Not Intersect(Target, rngDV) Is Nothing Then
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column >= 7 And Target.Column <= 16 Then
If oldVal <> "" And newVal <> "" Then
Target.Value = oldVal & "; " & newVal
End If
End If
End If
This is the code I have for my multiple selection list (which is only in column M):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Not Intersect(Target, rngDV) Is Nothing Then
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column >= 7 And Target.Column <= 16 Then
If oldVal <> "" And newVal <> "" Then
Target.Value = oldVal & "; " & newVal
End If
End If
End If