View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Can I protect all excel tabs in a file with one password entry?

Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
For N = 1 To Sheets.Count
With Sheets(N)
.Protect Password:="justme", AllowFormattingRows:=True
.EnableSelection = xlUnlockedCells
End With
Next N
Application.ScreenUpdating = True
End Sub

You might want to unprotect them all at some point.........

Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
For N = 1 To Sheets.Count
Sheets(N).Unprotect Password:="justme"
Next N
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP


On Wed, 29 Oct 2008 14:01:01 -0700, hollyc83
wrote:

I have no understanding of writing VB, but is it possilbe to write a macro
that will password protect all sheets in a workbook simultaneously with all
of the following options checked (and all others cleared): "Select unlocked
cells", "Format Rows"? Thanks in advance for any help on this issue. I can
copy and paste if someone else can write the code.

"Indiana born" wrote:

I have spreadsheets with multiple tabs - I presently have to password protect
each tab separately. I'm looking for a way to protect all tabs with one
password entry. i am not share the files, but others do view them and I
don't want changes made.