Creating/Adding Combobox

G

Guest

I have a userform that is used to enter item number (textbox1) and quantity
(textbox2). The listing of all existing item numbers and item descriptions
are in worksheet "Items" (A:A & B:B respectfully).

How do I create/add a combobox for textbox1 pulling from the list in the
Items worksheet?

Thanks,
Les
 
B

Bob Phillips

Dim cell As Range
Dim iLastRow As Long

With Me.ComboBox1
.Clear
iLastRow = Worksheets("Sheet1").Cells(Rows.Count,
"A").End(xlDown).Row
For Each cell In Worksheets("Sheet1").Range("A1").Resize(iLastRow)
If cell.Value = TextBox1.Value Then
.AddItem cell.Offset(0, 1).Value
End If
Next cell
End With


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top