Help in userform

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
Hello Everyone,


I am working on a Userform and need your urgent help on the same.


Purpose of this userform to open relevant workbook which are attached in workbook as Object


In userform


i have a drop down by the name of ComFruit


under that there are fruits name like Apple1, Apple2 and Orange1 and orange2


also having two checkbox by the name of coapple and coorange






there are four workbook embed in workwook. object 1, object 2 and object 3 and Object 4


I want if coapple (checkbox) is checked then ComFruit value is apple 1 and apple2 should be visible and if user select apple 1 and click on generate button. Generate button name is ComGeneFruit, then object 1 workbook should open. same apply for apple2 to open object 2




f coorange (checkbox) is checked then ComFruit value is orange1 and orange2 should be visible and if user select organge1 and click on generate button. Generate button name is ComGeneFruit, then object 3 workbook should open. same apply for orange2 to open object 4

i think should be done by OpenEmbeddedWB()


let me know if you need any further information


Please help
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi
I woud recommend to use radio buttos instead of checkboxes and group them so that only one is selected at a time. Here is something that can get you going:
Code:
Private Sub coapple_Click()
 
 If UserForm1.coapple.Value = True Then
  UserForm1.ComFruit.List = Array("Apple1", "Apple2")
 End If
 
End Sub
Private Sub coorange_Click()
 If UserForm1.coapple.Value = True Then
  UserForm1.ComFruit.List = Array("Orange1", "Orange2")
 End If
 
End Sub

Private Sub ComGeneFruit_Click()
    If ComFruit.Value = "Apple1" Then
     Sheets("Sheet1").OLEObjects("Object 1").Activate
    ElseIf ComFruit.Value = "Apple2" Then
     Sheets("Sheet1").OLEObjects("Object 2").Activate
    ElseIf ComFruit.Value = "Orange1" Then
     Sheets("Sheet1").OLEObjects("Object 3").Activate
    ElseIf ComFruit.Value = "Orange2" Then
     Sheets("Sheet1").OLEObjects("Object 4").Activate
    End If
End Sub
 
Last edited:
Upvote 0
for this i m getting error that object required :(

If UserForm1.coapple.Value = True Then
UserForm1.ComFruit.List = Array("Apple1", "Apple2") End If


Coapple is the name of the radio button
and userform1 is the name of userform and i m entering this coding post double click on radio button

do i have to linked any cell or anything? just asking. please help
 
Last edited:
Upvote 0
The error can b due to the fact that either those objects are missing on the form or are called diffrently.
Make sure of the follwoing:
- your user from is called "userform1"
- your dropdown box is called: "ComFruit"
- your checkbox fo apple i called: "coapple"

and remember that they are case sensetive.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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