Fordraiders
asked on
populate Combobox from multiColumn Text file pipe delimiter
vba 2010
userform with
combobox1
Textbox1
Right now loading combobox from text file...but the texfile has 2 columns seperated by a pipe delimiter.
I need to load combobox with this textfile so it shows 2 columns.
Then after i make a selection...in Textbox1 it will show only the value from Column2 in the combobox
Thanks
fordraiders
userform with
combobox1
Textbox1
Right now loading combobox from text file...but the texfile has 2 columns seperated by a pipe delimiter.
I need to load combobox with this textfile so it shows 2 columns.
Then after i make a selection...in Textbox1 it will show only the value from Column2 in the combobox
Dim InFilet As Integer
Dim NextTip As String
InFilet = FreeFile
Open "C:\Program Files\Crs Enterprise\iData\Defaults\DescSearch_Slang.txt" For Input As InFilet
While Not EOF(InFilet)
Line Input #InFilet, NextTip
UserForm2.ComboBox27.AddItem NextTip
Wend
Close InFilet
Thanks
fordraiders
they offer a soltuion of concatenating the data into a 3rd column as only one col is visible in excel... and then storing the 1st item when selected:
Private Sub UserForm_Initialize()
Dim i As Long
With ComboBox1
.ColumnCount = 3
.ColumnWidths = ";;0"
.TextColumn = 3
For i = 1 To 10
.AddItem Range("A1:A10").Cells(i, 1).Value
.List(.ListCount - 1, 1) = Range("D1:D10").Cells(i, 1).Value
.List(.ListCount - 1, 2) = .List(.ListCount - 1, 0) & vbTab & .List(.ListCount - 1, 1)
Next i
End With
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Any success with the above? you can use " " instead of VBTAB to space out the visible column...
ASKER
yes, Thanks very much !
http://www.mrexcel.com/forum/excel-questions/454709-populating-multi-column-combobox.html