Hi,
I'm trying to get a selected value from a listbox on a userform in Excel. This is the code I'm using:
If Me.Controls("lstCustNames".ListCount > 0 Then
For Cnt = 0 To Me.lstCustomerNames.ListCount
If Me.lstCustomerNames.Items(Cnt).Selected = True Then
CustName = Me.lstCustomerNames.ListIndex(Cnt).Value
End If
Next
End If
I've also tried listindex(cnt).selected and several other options, but I keep getting errors.
Can anybody help me?
Thanks
I'm trying to get a selected value from a listbox on a userform in Excel. This is the code I'm using:
If Me.Controls("lstCustNames".ListCount > 0 Then
For Cnt = 0 To Me.lstCustomerNames.ListCount
If Me.lstCustomerNames.Items(Cnt).Selected = True Then
CustName = Me.lstCustomerNames.ListIndex(Cnt).Value
End If
Next
End If
I've also tried listindex(cnt).selected and several other options, but I keep getting errors.
Can anybody help me?
Thanks