ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating/Adding Combobox (https://www.excelbanter.com/excel-programming/380704-creating-adding-combobox.html)

WLMPilot

Creating/Adding Combobox
 
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

Bob Phillips

Creating/Adding Combobox
 
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)


"WLMPilot" wrote in message
...
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





All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com