Try this:-
NB:- Substrings taken to be in column "A".
NB:- Userform Has controls:- "ListBox1" and Commanbutton1
NB:- ListBox filled by "Rowsource"
Option Explicit
Private Sub UserForm_Initialize()
ListBox1.MultiSelect = fmMultiSelectMulti
End Sub
Private Sub CommandButton1_Click()
Dim Rng As Range, Dn As Range, n As Long, Dic As Object
Dim V As Variant, Sp As Variant, S As Variant
Set Dic = CreateObject("scripting.dictionary")
ic.CompareMode = vbTextCompare
With ListBox1
For n = 0 To .ListCount - 1
Dic(.List(n)) = n
Next n
Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
For Each Dn In Rng
Sp = Split(Dn.Value, ",")
For Each S In Sp
If Dic.exists(S) Then
.Selected(Dic(S)) = True
End If
Next S
Next Dn
End With
End Sub
Regards Mick
Bookmarks