Macro to copy worksheet to new book, then turn on protection

Hydestone

Board Regular
Joined
Mar 29, 2010
Messages
137
I have a spreadsheet that I want to send outside of my organization, so that people can fill it in them return the spreadsheet to me.
I'll set up protection to prevent unwanted modifications to the SS.

It would look something like this....

1. I edit a worksheet and get it ready to go out to people.
2. Then I would copy that spreadsheet into a new Excel file (there are other worksheets in the workbook that i can't share).
3. Then add protection to the worksheet.
4. Then email it to them.

Thoughts on how to write this macro? And how would it be activated? Could I put t button on the sheet to activate the macro...but the button would not copy over with the worksheet to the new workbook?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I put this in the This Workbook module...is that the correct location? Not sure if that would have any impact on how the macro is working.
 
Upvote 0
It should go in a standard module not in the module for ThisWorkbook. Remove it from it's current location and run it from a standard module.
 
Upvote 0
Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the menu at the top click 'Insert' and then click 'Module'. Copy and paste the macro into the empty code window that opens up. Press the F5 key to run the macro. Close the code module window to return to your sheet. There are other quicker ways to run the macro such as assigning it to a button that you would click on your sheet or assigning it to a short cut key.
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,161
Members
448,948
Latest member
spamiki

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