How to protect a sheet if ...

A

Alf

Hi,

I have an XL file with a data to be entered by a user using one sheet per
date.
I also have a Results summary sheet where I use this sort of function,
=SUM(Monday 1st : Friday 5th!B3).

I would like to implement "Conditional protection" where a data sheet can
no longer be modified after a certain date. Example, if today is Tuesday
2nd, then the "Monday 1st"
sheet can no longer be modified.

An ideas ???

TIA

N.L.
 
X

xld

You need VBA.

Put thios code in the ThisWorkbook code module

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target A
Range)

Application.EnableEvents = False
On Error GoTo proc_exit
If CDate(Sh.Name) < Date Then
If Sh.ProtectContents <> True Then
Target.Value = ""
Sh.Protect
MsgBox "Changes not allowed to this sheet"
End If
End If
proc_exit:
Application.EnableEvents = True
End Su
 
Top