Returning Values
Hi,
You can set that up through the Properties without a single line of code:
Say you data for the combo is in sheet1!A2:A10
1- in the userform, select the combo and set its properties:
- fill up the combo with values. Set RowSource to : sheet1!A2:A10
- send the choice index to another sheet (hidden)
set BoundColumn to: 0 --- so that .Value returns the index
set ControlSource to: sheet2!a1 -- send Value there
Now the combo reads sheet1!a2:a10 and when the user pick a choice , it
sends the index of the choice (starting at 1) to sheet2!a1
2- Make textboxes read the corresponding value
- Texbox1 - set its ControlSOurce property to:
offset(sheet1!a2,sheet2!a1-1,1,1,1)
ie from begining of data (sheet1!a2) go 'sheet2!a1-1' row down, and 1
col right.
- Textbox2- set its ControlSOurce property to:
offset(sheet1!a2,sheet2!a1-1,2,1,1)
ie from begining of data (sheet1!a2) go 'sheet2!a1-1' row down, and 2
col right.
- ...
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
"Eric" wrote:
Hello there, I have a UserForm on which there is 1 ComboBox (ComboBox1) and 3
TextBoxes (Textboxes 1,2,3). The values for ComboBox1 and the TextBoxes are
stored in multiple columns on a sheet within the workbook. (Sheet1) (Columns
A,B,C,D) What I would like to do is this: When a user selects a value from
ComboBox1 (Gathered from Column A), I would like the Textboxes to
automatically fill in based upon the values from Columns B,C, and D
respectively. That is part one.
Part two, If the information gathered needs to be changed, I would like the
user to be able to change it in the Textbox and have the values automatically
update on the sheet. Any help would really be appreciated.
|