ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB and combo box (https://www.excelbanter.com/excel-programming/324038-vbulletin-combo-box.html)

[email protected]

VB and combo box
 
hello,

I have created a combo box using VB and I would like to assign a
different numerical value for every item in the list. So, what item is
selected the value appears in a shell. For example, for ice cream value
when it is clicked I want the value 3 appeared in cell A1 Can anyone
help?

Thanks in advance

Riri


Jake Marx[_3_]

VB and combo box
 
Hi Riri,

Riri wrote:
I have created a combo box using VB and I would like to assign a
different numerical value for every item in the list. So, what item is
selected the value appears in a shell. For example, for ice cream
value when it is clicked I want the value 3 appeared in cell A1 Can
anyone help?


There are a few different ways to do this. Here's one that requires no VBA
coding to accomplish:

1) set up your range of products in, let's say, A1:B3 as follows:

1 ice cream
2 cake
3 pizza

2) set the following properties of the ComboBox:

BoundColumn = 1
ColumnCount = 2
ColumnWidths = 0 pt
LinkedCell = Sheet1!A5
ListFillRange = Sheet1!A1:B3

Now, when the user selects an item in the dropdown, the cell A5 will reflect
the ID of the product selected.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


[email protected]

VB and combo box
 



Where can you put the properties?


Thanks

Riri


Jake Marx[_3_]

VB and combo box
 
Hi Riri,

Riri wrote:
Where can you put the properties?


That depends on where the control is. If you have it on a Worksheet, then
you can go to design view (click the protractor-looking icon), right-click
the combobox, and select Properties. When you're done, just click the
design mode button to exit design mode. If the control is on a userform,
you can modify the properties by selecting the combobox and changing the
values in the properties window. If it's not visible, hit F4 to display it.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]



All times are GMT +1. The time now is 12:56 PM.

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