brandyburk
New Member
- Joined
- Oct 17, 2013
- Messages
- 1
I have a sheet with many drop downs in different cells but all located in the same column. I have the following code that enables me to make just one of those drop downs a mult-select (cell C27). How do I modify it to include more than one cell (ie drop-downs)? I tried putting an OR in there and it won't work. Help! I need separate drop downs in cells C27 AND C29 to allow multiple selections but don't want to impact the other cells that have single selects in them.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oldVal As String
Dim newVal As String
If Target.Address(0, 0) <> "C27" Then Exit Sub
On Error GoTo ReEnable
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If oldVal <> "" And newVal <> "" Then
Target.Value = oldVal & ", " & newVal
End If
ReEnable:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oldVal As String
Dim newVal As String
If Target.Address(0, 0) <> "C27" Then Exit Sub
On Error GoTo ReEnable
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If oldVal <> "" And newVal <> "" Then
Target.Value = oldVal & ", " & newVal
End If
ReEnable:
Application.EnableEvents = True
End Sub