View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach[_2_] Otto Moehrbach[_2_] is offline
external usenet poster
 
Posts: 1,071
Default How to lock cells after a certain days

This little macro will lock cells B1:B10 when the file is opened if the date
in A1 is more than 2 days earlier than today's date. This macro must be
placed in the workbook module. HTH Otto
Private Sub Workbook_Open()
With Sheets("TheSheetName")
If Date - .Range("A1") 2 Then
.Range("B1:B10").Locked = True
End If
End With
End Sub

"Thu Ng" <Thu wrote in message
...
How can I lock cells B1 to B10 if the date shown in cell A1 maller than
today
2 days
please help.