View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Password Protection

You need to unlock those cells. Suppose you want to enable the user to edit
A1:B10 range for all worksheets; try the below. Please note that the below
macro will work on the workbook where the macro is copied

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1:B10").Locked = False
ws.Protect Password:="123"
Next ws
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ladytiger7481" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I also have ranges within these spreadsheets that need
to be able to be unlocked with a different password. I'm looking for a way to
write a macro to be able to do this to all the spreadsheets with one click. I
have already found how to just password protect with a macro, but can someone
please show me how to add the ablity to allow user to edit ranges in the
macro. This is the macro I am presently using....

Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Thanks so much for any help!