ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ComboBoxes and Formulas (https://www.excelbanter.com/excel-programming/278415-comboboxes-formulas.html)

excel user

ComboBoxes and Formulas
 
How do I get a formula to recognize a selection from a
Combo Box that I created from the Control Toolbox?

For example, if the LinkedCell is A2 and the formula in B2
uses the chosen value in A2 as the reference for a VLOOKUP
formula, what do I need to do to make the value in A2
recognizable to the formula in B2?

Do I have to do anything in Properties, or enter something
in the VBE?

Thanks.

EU

BrianB

ComboBoxes and Formulas
 
1. In a worksheet formula you have to use the linked cell to index
your range of values thus :-
=INDEX(H1:H6,A2,1)

2. In a macro you can get the selected value directly with something
like :-
MyValue = ActiveSheet.ComboBox1.Value

Use of *Controls toolbox* controls in a worksheet is not recommended
because they are extremely prone to bugs. Use those from the *Forms*
toolbox in preference. In this case you can only use the INDEX()
method to get the selected value.


Regards
BrianB
==================================================

"excel user" wrote in message ...
How do I get a formula to recognize a selection from a
Combo Box that I created from the Control Toolbox?

For example, if the LinkedCell is A2 and the formula in B2
uses the chosen value in A2 as the reference for a VLOOKUP
formula, what do I need to do to make the value in A2
recognizable to the formula in B2?

Do I have to do anything in Properties, or enter something
in the VBE?

Thanks.

EU


EU

ComboBoxes and Formulas
 
Thanks, Brian. I went with the Index formula and it works
perfectly!
Regards,
EU
-----Original Message-----
1. In a worksheet formula you have to use the linked cell

to index
your range of values thus :-
=INDEX(H1:H6,A2,1)

2. In a macro you can get the selected value directly

with something
like :-
MyValue = ActiveSheet.ComboBox1.Value

Use of *Controls toolbox* controls in a worksheet is not

recommended
because they are extremely prone to bugs. Use those from

the *Forms*
toolbox in preference. In this case you can only use the

INDEX()
method to get the selected value.


Regards
BrianB
================================================= =

"excel user" wrote in message

...
How do I get a formula to recognize a selection from a
Combo Box that I created from the Control Toolbox?

For example, if the LinkedCell is A2 and the formula in

B2
uses the chosen value in A2 as the reference for a

VLOOKUP
formula, what do I need to do to make the value in A2
recognizable to the formula in B2?

Do I have to do anything in Properties, or enter

something
in the VBE?

Thanks.

EU

.



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

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