MarieHazelwood-3838 avatar image
0 Votes"
MarieHazelwood-3838 asked emilyhua-msft edited

Select multiple values from an Excel dropdown list?

Online search suggested I use below VBA code to enable multiple selections in MS Excel dropdown list, save as Macro-Enabled and it should work. However, it's not working. Can you help?

'Code by Sumit Bansal from
' To allow multiple selections in a Drop Down List in Excel (without repetition)
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Target.Column = $G$ Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
If InStr(1, Oldvalue, Newvalue) = 0 Then
Target.Value = Oldvalue & ", " & Newvalue
Target.Value = Oldvalue
End If
End If
End If
End If
Application.EnableEvents = True
Application.EnableEvents = True
End Sub

Private Sub Workbook_Open()

End Sub

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

As this issue is more related to VBA code, but tag "office-excel-itpro" focus more on general issue of Excel client, I would modify this tag.
Thanks for your understanding.

0 Votes 0 ·

0 Answers