I hope my title is helpful, I'm not sure how to state the title.
I have a ComboBox, I am using Range A1:E1 for a list.
When I select from the list, I need to know what Column the text was from.
I don't know how to store or retrieve that when I create my list.
This is the code (Found from a users post) to populate the ComboBox.
Pretend A1:E1 are as follows:
01 02 03 04 05
PHP Code:
Private Sub UserForm_Initialize()
Dim objCell As Range
Dim colNoDuplicates As New Collection
Dim vItem As Variant
ComboBox1.Clear
On Error Resume Next
For Each objCell In Range("A1:E1")
colNoDuplicates.Add objCell.Value, CStr(objCell.Value)
Next objCell
For Each vItem In colNoDuplicates
MsgBox vItem.cell.Address 'for testing
ComboBox1.AddItem vItem
Next vItem
ComboBox1.ListIndex = 0
End Sub
Bookmarks