By: Lutfor Rahman Shimanto

In reply to Sherry.

Hello Sherry

Thanks for reaching out! Providing an ultimate solution without glancing at your Excel file is difficult. However, I suggest several things you may check to ensure the multi-selection drop-down works properly.

Ensure you have created named ranges for your dataset as described. Make sure that the strDVList variable correctly references your named range. To ensure that the named range CityNames is correctly referenced by strDVList, you can call the InitializeDVList subroutine in the Worksheet_SelectionChange event before it tries to use strDVList.

So, double-click on the user form and replace the existing code with the following:

Sub InitializeDVList()
strDVList = "CityNames"
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
Dim strList As String
On Error Resume Next
Application.EnableEvents = False
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Not Intersect(Target, rngDV) Is Nothing Then
If Target.Validation.Type = 3 Then
Call InitializeDVList
frmDVList.Show
End If
End If
exitHandler:
Application.EnableEvents = True
End Sub

Private Sub UserForm_Initialize()
Me.lstDV.RowSource = strDVList
End Sub

Private Sub cmdOK_Click()
Dim strSelItems As String
Dim lCountList As Long
Dim strSep As String
Dim strAdd As String
Dim bDup As Boolean
On Error Resume Next
strSep = ", "
With Me.lstDV
For lCountList = 0 To .ListCount - 1
If .Selected(lCountList) Then
strAdd = .List(lCountList)
Else
strAdd = ""
End If
If strSelItems = "" Then
strSelItems = strAdd
Else
If strAdd <> "" Then
strSelItems = strSelItems & strSep & strAdd
End If
End If
Next lCountList
End With
With ActiveCell
If .Value <> "" Then
.Value = ActiveCell.Value & strSep & strSelItems
Else
.Value = strSelItems
End If
End With
Unload Me
End Sub

Private Sub cmdClose_Click()
Unload Me
End Sub

Hopefully, these ideas will help you overcome your situation. Good luck.

Regards
Lutfor Rahman Shimanto
Excel & VBA Developer
ExcelDemy