M
Microsoft Communities
I am trying to protect all sheets in a range.
The sheet names are in date format "01-08-09" through "01-31-09" I have
tried the following and it bombs out on me.
Can someone help me with this.
Thank You
Sub Protect_All_Sheets()
'
' Protect_All_Sheets Macro
' Macro recorded 5/4/2006 by Ed Davis
' Modified 07/30/09
'
' Keyboard Shortcut: Ctrl+p
Application.ScreenUpdating = False
Dim MySelection As Range
Dim MyActCell As Range
'
Set MyActCell = ActiveCell
Set MySelection = Selection
'
Sheets("01-08-09").Select
Range("A1").Select
For I = 1 To 31
ActiveSheet.Protect Password:="7135"
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
Range("A1").Select
Next I
Application.Goto MySelection
MyActCell.Activate
Application.ScreenUpdating = True
End Sub
The sheet names are in date format "01-08-09" through "01-31-09" I have
tried the following and it bombs out on me.
Can someone help me with this.
Thank You
Sub Protect_All_Sheets()
'
' Protect_All_Sheets Macro
' Macro recorded 5/4/2006 by Ed Davis
' Modified 07/30/09
'
' Keyboard Shortcut: Ctrl+p
Application.ScreenUpdating = False
Dim MySelection As Range
Dim MyActCell As Range
'
Set MyActCell = ActiveCell
Set MySelection = Selection
'
Sheets("01-08-09").Select
Range("A1").Select
For I = 1 To 31
ActiveSheet.Protect Password:="7135"
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
Range("A1").Select
Next I
Application.Goto MySelection
MyActCell.Activate
Application.ScreenUpdating = True
End Sub