Forum Discussion
Dropdown list with multiple selection in cell
You can use VBA code to create a dropdown list with multiple selections in a cell. Here is an example of VBA code that you can use to achieve this:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Target.Address = "$F$2" 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
This code will allow you to select multiple items from the dropdown list in cell F2 by separating them with a comma. You can modify the code to fit your specific needs.
After also creating a dropdown menu, you can use this code to select multiple items from the dropdown list in cell F2 by separating them with a comma. You can adapt the code to your specific needs.
Attached is an example file where you can test the function.
Hope it will help you in your project!
Hi NikolinoDE
Thank you so much for your assistance...
I am not conversant with what code is and don't have the understanding ...
I was successful with the testing though when I named sheets did not work...
After inserting rows above to insert picture and freeze panes for "Headings" Sheet 1 is renamed to members ... data entry rows start at G9 and sheet (1) name is Members ....
So in essence Sheet 1 "Members" entry of dropdown would be from G9 to G108
Sheet 2 is renamed to Industry...
Also as multiple entries will be in G9 is there a way to view as a window if possible please
Regards,
@Charlie_The_Connetcor