ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Displaying one userform from another (https://www.excelbanter.com/excel-programming/342048-displaying-one-userform-another.html)

CFD[_2_]

Displaying one userform from another
 

Ok, this is such a rediculously simple problem, I am almost to
embarrassed to ask. After searching high and low, I cannot for the lif
of me figure out how to display one userform, when a user clicks on
button in another?

A simple Userform2.show does not work- the code breaks with an "objec
required" error.

I know I'm going to kick myself when I see the answer ... (can yo
delete topics you stated yourself so i can hang my head in shame?

--
CF

-----------------------------------------------------------------------
CFD's Profile: http://www.excelforum.com/member.php...fo&userid=2730
View this thread: http://www.excelforum.com/showthread.php?threadid=47365


Norman Jones

Displaying one userform from another
 
Hi CFD,

I could not reproduce your error and

Private Sub CommandButton1_Click()
UserForm2.Show
End Sub

worked for me.


---
Regards,
Norman



"CFD" wrote in message
...

Ok, this is such a rediculously simple problem, I am almost too
embarrassed to ask. After searching high and low, I cannot for the life
of me figure out how to display one userform, when a user clicks on a
button in another?

A simple Userform2.show does not work- the code breaks with an "object
required" error.

I know I'm going to kick myself when I see the answer ... (can you
delete topics you stated yourself so i can hang my head in shame?)


--
CFD


------------------------------------------------------------------------
CFD's Profile:
http://www.excelforum.com/member.php...o&userid=27306
View this thread: http://www.excelforum.com/showthread...hreadid=473653




CFD[_3_]

Displaying one userform from another
 

Hmmm was your command button on a different userform, or on
worksheet?

I can get it to open using a button on a worksheet, but not a button o
a different user form

--
CF

-----------------------------------------------------------------------
CFD's Profile: http://www.excelforum.com/member.php...fo&userid=2730
View this thread: http://www.excelforum.com/showthread.php?threadid=47365


Cush

Displaying one userform from another
 
Perhaps you are not putting your code in the correct location:

1. Open your VB editor
2. Select Userform1
3. Dbl click on the command button to view the code for this button
4. Paste Norman Jones code in this module. It's not a normal module,
but rather a special kind of module that contains the code for the userform1
and associated controls, like buttons.

HTH

"CFD" wrote:


Ok, this is such a rediculously simple problem, I am almost too
embarrassed to ask. After searching high and low, I cannot for the life
of me figure out how to display one userform, when a user clicks on a
button in another?

A simple Userform2.show does not work- the code breaks with an "object
required" error.

I know I'm going to kick myself when I see the answer ... (can you
delete topics you stated yourself so i can hang my head in shame?)


--
CFD


------------------------------------------------------------------------
CFD's Profile: http://www.excelforum.com/member.php...o&userid=27306
View this thread: http://www.excelforum.com/showthread...hreadid=473653



CFD[_4_]

Displaying one userform from another
 

Thanks cush. My code is certainly in the right place, associated with
the correct button on the userform ... Here is the code associated with
the button

Code:
--------------------

Private Sub CommandButton1_Click()
' store data on variables worksheet
Worksheets("variables").Range("curinitials").Value = initials.Value
Worksheets("variables").Range("curbarcpref").Value = barcpref.Value
Worksheets("variables").Range("curbarcfin").Value = barcfin.Value

' hide first step userform
Box_details.Hide

'show secondstep userform
box_contents.Show
End Sub

--------------------


Box_details is the first userform (on which CommandButton1 is located),
box_contents is the userform for the next step. The code dies at the
"box_contents.Show" point.


--
CFD


------------------------------------------------------------------------
CFD's Profile: http://www.excelforum.com/member.php...o&userid=27306
View this thread: http://www.excelforum.com/showthread...hreadid=473653


CFD[_5_]

Displaying one userform from another
 

FIXED

.... it was an error in the initialize routine for the second
userform!!! The code broke at the command button point and not in the
initialization script, which led me to think it was the display that
was the problem!

So sorry to have wasted all your time, (as he shrinks back in the
corner feeling very embarrassed!). It is however annoying that it broke
at the command button point, and not the point in the initializer
routine that was the problem! Made tracking the error very difficult!


--
CFD


------------------------------------------------------------------------
CFD's Profile: http://www.excelforum.com/member.php...o&userid=27306
View this thread: http://www.excelforum.com/showthread...hreadid=473653



All times are GMT +1. The time now is 02:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com