How to lock cells after a certain days

T

Thu Ng

How can I lock cells B1 to B10 if the date shown in cell A1 maller than today
2 days
please help.
 
O

Otto Moehrbach

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top