password protect copies of workbooks


G

Guest

Hi

I have a master workbook that runs various macros to create a copy of a
selected sheet from the master into a new workbook.

Whilst I can protect the master, am I able to include within the macro code
that creates the copy, an instruction to protect all cells marked as locked.

Thanks in anticipation
 
Ad

Advertisements

B

Bernie Deitrick

Dave,

Workbooks("MasterBook.xls").Sheets("Copy Me").Copy _
Before:=Workbooks("Target Book.xls").Sheets(1)
With Workbooks("Target Book.xls").Sheets("Copy Me")
.Name = "New Name" 'Optional
.Protect Password:="Password" 'Only needed if the original sheet was not protected
End With

HTH,
Bernie
MS Excel MVP
 

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