Open Embed excel files (Object) based on combo box value.

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
Hello


I made on combo box and gave name - ComFruit

Under that i added items via UserForm_Initialize()

comComfruit.AddItem "Apple1"
comComfruit.AddItem "Apple2"
comComfruit.AddItem "Apple3"
comComfruit.AddItem "Apple4"

Have one button and button name is ComGeneFruit

I want if from combox if
Apple1 is select and then click ComGeneFruit button then object 1 should be open
same for apple 2 for object 2 and apple 3 for object 3 and apple 4 for object 4.

this is just an example having big list of object and drop down list.

Please help.

 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I think we have solved a similar task in your other post. But here we go again:

in developer mode double click on the ComGeneFruit button and place this code in the sub:
Code:
    If comComfruit.Value = "Apple1" Then
     Sheets("Sheet1").OLEObjects("Object 1").Activate
    ElseIf comComfruit.Value = "Apple2" Then
     Sheets("Sheet1").OLEObjects("Object 2").Activate
    ElseIf comComfruit.Value = "Apple3" Then
     Sheets("Sheet1").OLEObjects("Object 3").Activate
    ElseIf comComfruit.Value = "Apple4" Then
     Sheets("Sheet1").OLEObjects("Object 4").Activate
    End If

Pleae check if your comb is called ComFruit or comComfruit and remeber that things are case sensetive. Also change the sheet name to that sheet where your objects are embeded.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,377
Messages
6,119,182
Members
448,872
Latest member
lcaw

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