Can't figure it out.. Duplicating a userform

MFish

Board Regular
Joined
May 9, 2019
Messages
76
Hi there,

I'm sure there is a way of duplicating a userform. How do you do this? I just need to make three userforms, all EXACTLY alike. I don't want to take the time to measure it all out and place the buttons all the same.

Thanks.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Code:
Set myForm1 = New UserForm1
Set myForm2 = New UserForm1
Set myForm3 = New UserForm1
 
Upvote 0
Do this:
Open a New Workbook
So now you have the Workbook with your original UserForm Open and a New empty Workbook Open

In the Vba Project Window select your original UserForm and drag it into your New Workbook

Now Give the New Userform a New Name
And Drag it back into The original workbook

Now rename the Userform in your Empty workbook and now drag it into your Original Workbook

Now you have three Userforms in your original workbook with three different names

Then you can just close the new Workbook and do not save changes.

You cannot have three Userforms in the same workbook with the same name
 
Last edited:
Upvote 0
Why would you want three copies of the same userform rather than instancing a single form?
 
Upvote 0
From my understanding exporting a UserForm requires creating a new Workbook

Dragging the Userform into A empty Workbook and then renaming it and then dragging it back into the Original workbook would not require creating a new Workbook.

The workbook you drag them into would not need to be saved
 
Upvote 0
You rename the form in the currently opened workbook. then import your form.

you will have to rename them either way.
 
Upvote 0
From my understanding exporting a UserForm requires creating a new Workbook

No you can export it to another file location (say your desktop) and then import it from there but you would need to rename the original userform.
 
Upvote 0
I like the dragging technique.
I do it all the time when I drag Marcro module into my Personal Workbook
I write macros in my Normal workbook test them out and then drag them into my Personal Workbook
It takes 5 seconds

I do the same with Userforms

This way the Macro can be used in any Workbook
 
Last edited:
Upvote 0
Thank you all.

As for your question, why 3 of the same userforms? I am building a database for a trucking company, that I work for. Each new, but similar, userform will ask the same questions based on the three different comboboxes from the userform prior. But, I need them to be unique so my textboxes from the original userform can copy the same value from the userform that was just shown. Unless there's an easier way, I don't know. I usually get by with what I do but I'm sure the codes I write are miles long, when they don't need to be.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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