combo box in excel + VB

sbrajagopal7

New Member
Joined
Jun 28, 2014
Messages
2
Hi,

1. I have placed couple of Combox boxes with Activex control.
2. I have linked the cells to display "OJT" and "P2P" in cobo box 1.
My Question
3. If i select "OJT" in combo box1 it has to load "Windows" "Intel" "VMware" in combo box2.
4. If i select "P2P" in combo box1 it has to load "Incoming" "Storage" "WebLogic" in combo box2.
How can i do this..I am using MsOffice 2010.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
  • Right-click on the sheet tab that has the combobxes
  • Select View Code from the pop-up context menu
  • Paste the code from below into the worksheet's code module

Code:
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] ComboBox1_Change()
    ComboBox2.Clear
    [COLOR=darkblue]Select[/COLOR] [COLOR=darkblue]Case[/COLOR] ComboBox1.ListIndex
        [COLOR=darkblue]Case[/COLOR] [COLOR=darkblue]Is[/COLOR] = 0: ComboBox2.List = Array("Windows", "Intel", "VMware")
        [COLOR=darkblue]Case[/COLOR] [COLOR=darkblue]Is[/COLOR] = 1: ComboBox2.List = Array("Incoming", "Storage", "WebLogic")
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Select[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]
 
Upvote 0
  • Right-click on the sheet tab that has the combobxes
  • Select View Code from the pop-up context menu
  • Paste the code from below into the worksheet's code module

Code:
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] ComboBox1_Change()
    ComboBox2.Clear
    [COLOR=darkblue]Select[/COLOR] [COLOR=darkblue]Case[/COLOR] ComboBox1.ListIndex
        [COLOR=darkblue]Case[/COLOR] [COLOR=darkblue]Is[/COLOR] = 0: ComboBox2.List = Array("Windows", "Intel", "VMware")
        [COLOR=darkblue]Case[/COLOR] [COLOR=darkblue]Is[/COLOR] = 1: ComboBox2.List = Array("Incoming", "Storage", "WebLogic")
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Select[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]

Thank you very much...it worked :)
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

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