User Form combine

charly1

Board Regular
Joined
Jul 18, 2023
Messages
87
Office Version
  1. 365
Platform
  1. Windows
Hi all

I've tried my hardest to work this out myself but I keep getting stuck.

I have two separate User forms with lots of code in each. User form 2 includes 1 list box, 1 combo box, and 1 command button.

I would like to copy the entire userform2 into a separate page within user form 1. I already have multipage in User form 1. From here I have no idea where to go

Can anyone help?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
How about putting two tabs on UserForm1? Tab1 could be your current UserForm1 controls, Tab2 could be your UserForm2 controls.

Tab 1 example

1689944110234.png


Tab 2 Example
1689944173187.png
 
Upvote 0
You should be able to cut and paste controls from to form to another. Create a new tab on UserForm1, Select all the controls on UserForm2 and copy them paste them to the new tab on UserForm1.

You can copy all of your code from UserForm2.

The only negative is that your ControlNames might have to change if they are not unique; if UserForm2 has control names that are the same as in UserForm1 they will have to change accordingly; then any code you have for those controls will have to changed the Sub Names respectively.
 
Upvote 0
I suggest that you change the names of any duplicate control names in UserForm2 before doing your Copy and Paste. That way you will not have conflicting control names when you paste controls and code to UserForm1.
 
Upvote 0
I suggest that you change the names of any duplicate control names in UserForm2 before doing your Copy and Paste. That way you will not have conflicting control names when you paste controls and code to UserForm1.
Hi



Please find attached above links to the two workbooks, each of which contains a user form. One of the user forms is multipage and already has the controls in this second page. I need to copy all the coding from the other workbook user form into the controls of that second page and have no idea how?
 
Upvote 0
I have done the following:
  1. Created a new tab (page) in Userform_main.xlsm
  2. Copied controls from Other.xlsm to Userform_main
    - to prevent control name conflicts with the original Userform_main controls the new controls on page 3 are as follows:
    >> btnTab3_1 - this is the command button on the bottom of the page
 
Upvote 0
>> lstTab3_1 - list box in the center of the page
>> cbxTab3_1 - the combo box at the top of the page

there are some sub name duplications (on of them is comment out for now) : get_filterX() it commented version uses data from Table 1. I did not move sheets from Other to Userform_main.
there are initialization errors when the form opens. I assume this is because the data it needs is still in the Other.xlsm spreadsheet.

So, I hope you can move forward with the what I have done. And hopefully I have not messed it up too much.

Here is a link to the consolidated Userform_main.xlsm file: new name Userform_main_New.xlsm
Userform_man_New.xlsm
 
Upvote 0
Solution

Forum statistics

Threads
1,215,073
Messages
6,122,970
Members
449,095
Latest member
Mr Hughes

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