E
Ed Davis
This macro stopped working on the "03" sheet it worked on the two sheets
before.
The Range "B1" in both sheets are a date the first sheet holds "01/08/09"
the first of the month.
the second sheet hold the date "31/08/09" the last day of the month.
All the sheets in between are day numbers "01" - "31".
It worked before when I put the start date as 2009,08,01
and the end date as 2009,08,31
Sub UnProtect_All_Sheets()
' Thanks to Dave Peterson for the below code.
Dim StartDate As Date
Dim EndDate As Date
Dim dCtr As Date
Set MyActCell = ActiveCell
Set MySelection = Selection
StartDate = Worksheets("01").Range("B1").Value
EndDate = Worksheets("Totals").Range("B1").Value
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For dCtr = StartDate To EndDate
With Worksheets(Format(dCtr, "dd"))
.Select
.Range("A1").Select
.Unprotect Password:="7135"
End With
Next dCtr
On Error GoTo 0
Application.Goto MySelection
MyActCell.Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
before.
The Range "B1" in both sheets are a date the first sheet holds "01/08/09"
the first of the month.
the second sheet hold the date "31/08/09" the last day of the month.
All the sheets in between are day numbers "01" - "31".
It worked before when I put the start date as 2009,08,01
and the end date as 2009,08,31
Sub UnProtect_All_Sheets()
' Thanks to Dave Peterson for the below code.
Dim StartDate As Date
Dim EndDate As Date
Dim dCtr As Date
Set MyActCell = ActiveCell
Set MySelection = Selection
StartDate = Worksheets("01").Range("B1").Value
EndDate = Worksheets("Totals").Range("B1").Value
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For dCtr = StartDate To EndDate
With Worksheets(Format(dCtr, "dd"))
.Select
.Range("A1").Select
.Unprotect Password:="7135"
End With
Next dCtr
On Error GoTo 0
Application.Goto MySelection
MyActCell.Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub