macro to protect sheet

R

richzip

I have macro code set up to copy data from a large worksheet into a template,
and then save the template with a new name.

I would like to protect the worksheet after copying the data onto it. I
want the options "select locked cells" and "select unlocked cells" to be the
only ones checked.

What macro code can I add to accomplish this?

Thank you
 
J

Jim Rech

Have you tried recording a macro as you do this manually?

--
Jim
|I have macro code set up to copy data from a large worksheet into a
template,
| and then save the template with a new name.
|
| I would like to protect the worksheet after copying the data onto it. I
| want the options "select locked cells" and "select unlocked cells" to be
the
| only ones checked.
|
| What macro code can I add to accomplish this?
|
| Thank you
 
M

Mike H

Hi,

That's the default for sheet protection so use

Sub sonic()
'Your code
ActiveSheet.Protect Password:="mypass"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top