Macro to Protect the Whole Workbook and Allow Range Edits

  • Thread starter Thread starter EugeniaP
  • Start date Start date
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!
 
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
 
Mike,

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

EugeniaP
 
Back
Top