ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Control Toolbox (https://www.excelbanter.com/excel-worksheet-functions/32174-control-toolbox.html)

John Data

Control Toolbox
 
If I link a cell in a combo box in the Forms module and look up the first
item in a range, the linked cell fills in with number 1. If I select the
secong item in the range, number 2 is filled in the linked cell and so on.
How can I get the same result by using the combo box in the control toolbox
menu as it fills in the linked cell with the actual data from the lookup
range rather than numbers 1, 2 etc?

Bob Phillips

You have to MATCH it against the combobox source data in then click event.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John Data" wrote in message
...
If I link a cell in a combo box in the Forms module and look up the first
item in a range, the linked cell fills in with number 1. If I select the
secong item in the range, number 2 is filled in the linked cell and so on.
How can I get the same result by using the combo box in the control

toolbox
menu as it fills in the linked cell with the actual data from the lookup
range rather than numbers 1, 2 etc?




John Data

Hi Bob
Sorry to be a pain

What exactly do you mean "MATCH it against the combobox source and click
event"?


"Bob Phillips" wrote:

You have to MATCH it against the combobox source data in then click event.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John Data" wrote in message
...
If I link a cell in a combo box in the Forms module and look up the first
item in a range, the linked cell fills in with number 1. If I select the
secong item in the range, number 2 is filled in the linked cell and so on.
How can I get the same result by using the combo box in the control

toolbox
menu as it fills in the linked cell with the actual data from the lookup
range rather than numbers 1, 2 etc?





Bob Phillips

I thought you might ask that <vbg

Say the source data is in Sheet2, cells A2:A20. The combobox returns the
value, so you match against the source,

=MATCH(val,Sheet2!A2:A20,0)

in VBA

Application.MatchCombobox1.Value, Worksheets("Sheet2").Range("A2:A20"), 0)

This would be done within the combobox click event

--
HTH

Bob Phillips

"John Data" wrote in message
...
Hi Bob
Sorry to be a pain

What exactly do you mean "MATCH it against the combobox source and click
event"?


"Bob Phillips" wrote:

You have to MATCH it against the combobox source data in then click

event.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John Data" wrote in message
...
If I link a cell in a combo box in the Forms module and look up the

first
item in a range, the linked cell fills in with number 1. If I select

the
secong item in the range, number 2 is filled in the linked cell and so

on.
How can I get the same result by using the combo box in the control

toolbox
menu as it fills in the linked cell with the actual data from the

lookup
range rather than numbers 1, 2 etc?








All times are GMT +1. The time now is 04:05 AM.

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