ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   concatenting rows for excel combo box output (https://www.excelbanter.com/excel-programming/377951-concatenting-rows-excel-combo-box-output.html)

Alex[_33_]

concatenting rows for excel combo box output
 
Step 1 of what I wish to accomplish:

I have two rows, col A and Col B.

ColA is for First Name and Col B is for Last Name.

I want to present a combo box that displays the contents of these rows
as if the data were from one single row

Step 2 of what I wish to accomplish:

Once the user makes the selection in the combo box I want the output to
essentially concatentate the Col A and Col B for the selected row so
that if for example they choose from the combo list:

Joe Smith

The resulting entry into the destination field would be Joe Smith. Not
merely Joe.


Tom Ogilvy

concatenting rows for excel combo box output
 
Use code like the below to fill the combobox. Then the result will be the
selected item in the combobox.

set rng = Range(Range("A2"),Range("A2").End(xldown))
for each cell in rng
me.combobox1.AddItem = cell.Value & _
" " & cell.offset(0,1).Value
Next




"Alex" wrote:

Step 1 of what I wish to accomplish:

I have two rows, col A and Col B.

ColA is for First Name and Col B is for Last Name.

I want to present a combo box that displays the contents of these rows
as if the data were from one single row

Step 2 of what I wish to accomplish:

Once the user makes the selection in the combo box I want the output to
essentially concatentate the Col A and Col B for the selected row so
that if for example they choose from the combo list:

Joe Smith

The resulting entry into the destination field would be Joe Smith. Not
merely Joe.



Alex[_33_]

concatenting rows for excel combo box output
 
Thank you Tom, the code you sent worked great. I really appreciate the
help! :)




Tom Ogilvy wrote:
Use code like the below to fill the combobox. Then the result will be the
selected item in the combobox.

set rng = Range(Range("A2"),Range("A2").End(xldown))
for each cell in rng
me.combobox1.AddItem = cell.Value & _
" " & cell.offset(0,1).Value
Next




"Alex" wrote:

Step 1 of what I wish to accomplish:

I have two rows, col A and Col B.

ColA is for First Name and Col B is for Last Name.

I want to present a combo box that displays the contents of these rows
as if the data were from one single row

Step 2 of what I wish to accomplish:

Once the user makes the selection in the combo box I want the output to
essentially concatentate the Col A and Col B for the selected row so
that if for example they choose from the combo list:

Joe Smith

The resulting entry into the destination field would be Joe Smith. Not
merely Joe.





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

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