PDA

View Full Version : [SOLVED:] Multiple drop down selections in the same cell



mhaasch
07-24-2019, 08:47 AM
I am trying to have a drop down where multiple selections can be made and they’ll be listed in the same cell. I am using code from here: https://trumpexcel.com/select-multiple-items-drop-down-list-excel/ It worked once. I then tried to add the following to have the selections on new lines instead of listed with commas:Target.Value = Oldvalue & vbNewLine & NewvalueThat line didn't work. I then tried to change back to the list with commas, as shown in the copied code below. Now that doesn't work. Must be something simple, but what?All Code:Private Sub Worksheet_Change(ByVal Target As Range)'Code by Sumit Bansal from https://trumpexcel.com' To make mutliple selections in a Drop Down List in ExcelDim Oldvalue As StringDim Newvalue As StringOn Error GoTo ExitsubIf Target.Column = 4 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 Target.Value = Oldvalue & ", " & Newvalue End If End IfEnd IfApplication.EnableEvents = TrueExitsub:Application.EnableEvents = TrueEnd Sub

mhaasch
07-24-2019, 09:11 AM
It was something simple - it was the column number. Thank you for your time.