To dynamically display Text based on dependent combo box selection on a Button click

Vivek Raaja

New Member
Joined
Dec 23, 2016
Messages
1
Dear Experts,

Am looking forward to get clarified on a excel vba macros code.

Below is my actual requirement,

1. I will have 3 combobox (Which everything is inter dependent --- Combobox2 is dependent on Combobox1, Combobox3 is dependent on Combobox2)
2. I will have a textbox created at the bottom, where this should dynamically change according to the ComboBox selected
3. I will have a Command button at the bottom which should be the trigger point for the text in the texbox (mentioned above).

So Far i have written the following code

Private Sub ComboBox1_Change()
Dim index As Integer
index = ComboBox1.ListIndex


ComboBox2.Clear


Select Case index
Case Is = 0
With ComboBox2
.AddItem "Post"
.AddItem "Pre-post"
.AddItem "Revoke"
End With


With ComboBox3
.AddItem "Europe"
.AddItem "America"
.AddItem "Asia"

End With
Case Is = 1
With ComboBox2
.AddItem "Post"
.AddItem "Revoke"
End With
With ComboBox3
ComboBox3.Clear
End With



Case Is = 2
With ComboBox2
.AddItem "Post"
.AddItem "Revoke"
End With
With ComboBox3
ComboBox3.Clear
End With
End Select
End Sub


Private Sub ComboBox2_Change()


End Sub


Private Sub CommandButton1_Click()
TextBox1.Text = "http://mrexcel.com/"
End Sub


Private Sub TextBox1_Change()


End Sub


Private Sub UserForm_Initialize()


With ComboBox1
.AddItem "XXXXX"
.AddItem "YYYYY"
.AddItem "ZZZZZZ"
End With


End Sub

I couldn't able to dynamically connect the textbox to display the message based on the selection

Please be so kind in guiding me in a way to accomplish this task successfully

Many thanks for your feedback in advance!

Thanks & Regards
Vivek Raaja.B
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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