Hi friends
i am having time sheet workbook, this work book has around 30 sheets and each sheets named as date format(like 02-08-2011,03-08-2011) now i need to protect sheets which based on following conditions
1. user should not do any modification previous day work sheet (ie:- if today date is 04-08-2011 then previous all days sheet should be protected)
I've write code for this , its protecting all the sheets , not based on my conditions ,
Sub protectsheets()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
If Format(Now, "dd-mm-yyyy") < Format(CDate(wSheet.Name), "dd-mm-yyyy") Then
wSheet.Protect Password:="Rhy77"
Else
wSheet.Unprotect Password:="Rhy77"
End If
Next wSheet
End Sub
Kindly help me
i am having time sheet workbook, this work book has around 30 sheets and each sheets named as date format(like 02-08-2011,03-08-2011) now i need to protect sheets which based on following conditions
1. user should not do any modification previous day work sheet (ie:- if today date is 04-08-2011 then previous all days sheet should be protected)
I've write code for this , its protecting all the sheets , not based on my conditions ,
Sub protectsheets()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
If Format(Now, "dd-mm-yyyy") < Format(CDate(wSheet.Name), "dd-mm-yyyy") Then
wSheet.Protect Password:="Rhy77"
Else
wSheet.Unprotect Password:="Rhy77"
End If
Next wSheet
End Sub
Kindly help me
Last edited: