I have this vba, it will unprotect, and it all works except at the end, it will not protect. Here is the code, I hope someone could assist me with this.
Thanks,
Pujo
Code:
Private Sub CommandButton1_Click()
For i = 1 To Sheets.Count
Sheets(i).Unprotect Password:=""
Next i
With Application
.ScreenUpdating = False
.EnableEvents = False
Range("J7") = Now()
If Sheets("Wednesday").Range("E7").Value = "Wednesday" Then
Sheets(Array("Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", _
"Tuesday")).Select
Sheets("Wednesday").Activate
Range("B9:G25").Select
Selection.ClearContents
Range("B28:I37").Select
Selection.ClearContents
Range("B40:B47").Select
Selection.ClearContents
Range("B9").Select
Sheets("Wednesday").Select
Else
MsgBox "Today is not Wednesday. You can only create a new report on Wednesday !", vbOKOnly, "Hey !"
With Application
.ScreenUpdating = True
.EnableEvents = True
Range("B9").Select
For i = 1 To Sheets.Count
Sheets(i).Protect Password:=""
Next i
End With
End If
End With
End Sub
Pujo