Two userforms - calling a userform method from another userform

RawlinsCross

Active Member
Joined
Sep 9, 2016
Messages
437
So I have two userforms. I kind of get how to call a subroutine of a userform from another:

1. Ensure you declare the subroutine as Public
2. From Userform2, call the subroutine in Userform1 by using: Call Userform1.NameofSubRoutine

I'm following the progression of the code by stepping through the code. I'm finding that the code doesn't immediately run through Userform1.NameofSubRoutine, but instead first runs through Userform_Initialize of Userform1 before going to NameofSubRoutine of Userform1.

Why question is why does this happen? And is there anything I can do to prevent this from happening?
 
The Set frm = New SummaryGraph would make a new instance of the first UF. But I don't know why that line it would be called by Userform1.NameOfSubRoutine.
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,215,453
Messages
6,124,930
Members
449,195
Latest member
Stevenciu

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