Macro to Protect the Whole Workbook and Allow Range Edits

E

EugeniaP

Hi, there!

I was wondering if it's possible to create a macro that would password
protect the whole workbook at once without having to protect each individual
sheet, and at the same time allow users to edit a specific range.

Thanks!
 
M

Mike H

Hi,

Do you mean this?

Sub sonic()
For x = 1 To Worksheets.Count
Sheets(x).Range("A1:H10").Locked = False
Sheets(x).Protect Password:="MyPass"
Next
End Sub

Unlock as many/few cells in each sheet as you require.

Mike
 
E

EugeniaP

Mike,

It's giving me a run-time error '1004' Unable to set the Locked property of
the Range class.

EugeniaP
 

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