Replace Worksheet vba

Noz2k

Well-known Member
Joined
Mar 15, 2011
Messages
693
So I have 2 workbooks, 1 which is always open for editing, and another which just stores data.

When a userform is opened in the first workbook, the user fills the form in, clicks submit, which opens the 2nd workbook, posts the data to the first empty row of sheet1, saves the 2nd workbook and then closes it.

However what I want to add, is between saving and closing the 2nd workbook, I would like to replace sheet1 in the 1st workbook with a copy of sheet1 in the 2nd workbook.

How would I go about doing this?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Is the best way to just delete sheet1 is the 1st workbook, and then copy sheet1 from the 2nd workbook into the 1st?
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,147
Members
452,891
Latest member
JUSTOUTOFMYREACH

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