ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo Box (https://www.excelbanter.com/excel-programming/282116-combo-box.html)

Davo[_2_]

Combo Box
 
Hi

I have created a dropdown box (Combo) and have initailised
it by placing values in it via the Form_Load()Command

eg lstOneCol.additem "Buses"

The user thus selects a value from the list at runtime -
now is when my VB memory fails me. The chosen option is
in text form I need it in numericals so that I can perform
a calculation on it

eg the user choses "Buses" from the dropdown list. I then
need to be able to relate this to a value i.e. 23 (miles
to the gallon) with which I can put in equations etc. I
just cannot remember how to do this


THanks in advance.



Tom Ogilvy

Combo Box
 
In Excel, you can do this:

Maybe you have a table with

Buses 23
Cars 40

you could use a Vlookup formula

res =
Application.Vlookup(combobox1.Value,worksheets("Da ta").Range("A1:B20"),2,Fal
se)

--
Regards,
Tom Ogilvy


Davo wrote in message
...
Hi

I have created a dropdown box (Combo) and have initailised
it by placing values in it via the Form_Load()Command

eg lstOneCol.additem "Buses"

The user thus selects a value from the list at runtime -
now is when my VB memory fails me. The chosen option is
in text form I need it in numericals so that I can perform
a calculation on it

eg the user choses "Buses" from the dropdown list. I then
need to be able to relate this to a value i.e. 23 (miles
to the gallon) with which I can put in equations etc. I
just cannot remember how to do this


THanks in advance.






All times are GMT +1. The time now is 03:50 PM.

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