Display Text depending on a value of a Combo Box

falia57

New Member
Joined
Sep 21, 2017
Messages
4
Hello everybody,

I would like to create a combo box in Word and depending on the value of the combo box (A, B, or C) that the text associated with the value displays on the word. (or excel 2010 but I would prefer Word 2010 if possible)

For exemple I named my combo box "Choice" and inside there is A, B and C
If I choose A I want to have a text poping "aaaaaa" , If I choose B I would like to see "bbbbb" ...

I tried to do something in VBA but I am not a master so I can't reach the solution :

Sub Choice()
If combobox1.Text.contains("A") Then
Print/displays ????
End Sub


Thank you in advance for your help
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi falia57,

Since you asked in the Excel forum here's how I would do it in Excel (I have Excel 2016, but should hopefully work in prior versions as well).


  1. Show 'Developer' tab in Excel (here's how-to just in case: https://support.office.com/en-us/article/Show-the-Developer-tab-E1192344-5E56-4D45-931B-E5FD9BEA2D45)
  2. Insert a ComboBox (Use the 'Insert...' button on the Developer tab and select the Combobox in the ActiveX Controls section).
  3. Once the ComboBox is on the sheets, make sure you are in 'Design Mode' (button next to the 'Insert...' button) and open the Properties of the Combobox (e.g. via right-click).
  4. The Properties to change are as follows:
    LinkedCell --> This is where your output will show up, in my example below this is set to D1.
    ListFillRange --> This will give the selection options as well as the corresponding outputs (e.g. Option "A", with output "aaaaa"). The easiest way to fill the ComboBox is to give it a Range in Excel where you have already typed in the options (can be on the same sheet or a different one. In my example below this is set to A1:B2.
    BoundColumn --> Set this to 2. This will ensure that while the ComboBox shows the selection options in column 1 of the ListFillRange, the LinkedCell will show the output of column 2 as you intended.

See below my example table:

Excel 2016 (Windows) 32 bit
ABCD
1Aaaaaaaabbbbbbb
2Bbbbbbbb

<tbody>
</tbody>




Hope this helps, let me know how it goes.

Kind regards,
Bernd
 
Upvote 0
Thank you very much it's exacly ehat I wanted to get !

Is there a way to incorpore it in a Word file ?

Thanks again !
 
Upvote 0
Thank you very much it's exacly ehat I wanted to get !

Is there a way to incorpore it in a Word file ?

Thanks again !

I'll have to let someone else answer that question as I am not very familiar with Word/VBA specificities unfortunately.
Hope you find the right answer.

Kind regards,
Bernd
 
Upvote 0

Forum statistics

Threads
1,215,350
Messages
6,124,431
Members
449,158
Latest member
burk0007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top