I have a listbox that allows for multiple selections. However I want to select just one of theitems based on a variable value.
So I will set variable “Department” to the value in cellD28
Then use that variable to select just that one item from themultiselect listbox. Prior to thisselection, there will be no items selected in the listbox.
So I will set variable “Department” to the value in cellD28
Then use that variable to select just that one item from themultiselect listbox. Prior to thisselection, there will be no items selected in the listbox.
Code:
Dim Department As String
Department = Range("D28")
With Sheets("Distribution").OLEObjects("ListBox1").Object
For i = 0 To .ListCount - 1
if .selected(i) = Department
.Selected(i) = True
End If
Next i
End With
Last edited: