Hello,
I want to make a listbox that contain 2 columns, ID and Item name. It is possible to choose multiple items in listbox with 2 column and transfer the data to the worksheet?
I also have a lot of items, so I think I must make a search bar for the listbox.
So first I search id on the search bar, select that item on listbox (the listbox must show 2 column), and then transfer the id and items to worksheet.
I have try to use combo box and listbox, but its not working.
Private Sub CmbITEM_Change()
Me.LbITEM.AddItem Me.CmbITEM
For x = 1 To 2
Me.LbITEM.List(LbITEM.ListCount - 1, x) = Me.CmbITEM.Column(x)
Next x
End Sub
Private Sub UserForm_Initialize()
CmbITEM.List = Sheet2.Range("A2:A1000").Value
Dim i As Long
For i = 1 To Apllication.WorksheetFunction.CountA(Sheet2.Range("A:A"))
Me.CmbITEM.AddItem Sheet2.Cells(i, 1)
For x = 1 To 2
Me.CmbITEM.List(CmbITEM.ListCount - 1, x) = Sheet2.Cells(i, x + 1)
Next x
Next i
End Sub
Thank you for your help
I want to make a listbox that contain 2 columns, ID and Item name. It is possible to choose multiple items in listbox with 2 column and transfer the data to the worksheet?
I also have a lot of items, so I think I must make a search bar for the listbox.
So first I search id on the search bar, select that item on listbox (the listbox must show 2 column), and then transfer the id and items to worksheet.
I have try to use combo box and listbox, but its not working.
Private Sub CmbITEM_Change()
Me.LbITEM.AddItem Me.CmbITEM
For x = 1 To 2
Me.LbITEM.List(LbITEM.ListCount - 1, x) = Me.CmbITEM.Column(x)
Next x
End Sub
Private Sub UserForm_Initialize()
CmbITEM.List = Sheet2.Range("A2:A1000").Value
Dim i As Long
For i = 1 To Apllication.WorksheetFunction.CountA(Sheet2.Range("A:A"))
Me.CmbITEM.AddItem Sheet2.Cells(i, 1)
For x = 1 To 2
Me.CmbITEM.List(CmbITEM.ListCount - 1, x) = Sheet2.Cells(i, x + 1)
Next x
Next i
End Sub
Thank you for your help