I have some code which generates a selection on a listbox, based on the values in a cell. The code is
The Problem I am having is that when I then change the UniqueID the previous selections remain. So before running the above code I need to clear the listbox selection on the UniqueId_Change event.
How can I do this?
Code:
Dim n As Long
Dim strInput As String, strOutput As String
Dim varZz As Variant, i As Integer
strInput = Sheets("Sheet1").Range("AT" & cboUniqueID.ListIndex + 3) ' i.e. cell with SHEAR; LATERAL BENDING; FLEXION
varZz = Split(strInput, ", ") 'create array of values using ";" as delimiter
For i = LBound(varZz) To UBound(varZz) 'loop through values
strOutput = varZz(i)
For n = 0 To Listbox1.ListCount - 1
If Listbox1.Column(0, n) = strOutput Then
Listbox1.Selected(n) = True
Exit For
End If
Next
Next i
The Problem I am having is that when I then change the UniqueID the previous selections remain. So before running the above code I need to clear the listbox selection on the UniqueId_Change event.
How can I do this?