ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to lock cells after a certain days (https://www.excelbanter.com/excel-worksheet-functions/248487-how-lock-cells-after-certain-days.html)

Thu Ng

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


Otto Moehrbach[_2_]

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.



All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com