How do I lock cells in excel365 by date and time

Tony S 15 Reputation points
2023-06-07T09:37:45.8866667+00:00

Hi,
I have a table which is editable. So I have say 10 rows 3 columns. In each of the rows I want to be able to stop them being editable after a date and time. Each row will may have the same date but a different time.
So in row one and the 3 columns ( 3 cells) I want to stop editing after 24th August 2023 at 1800 hours.
In row 2 and the 3 columns ( 3 cells) I want to stop editing on the 24th August at 18:30
Row 3 would be 26th August at 19:00
How would I do that on the worksheet please.

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
5,197 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,986 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Tanay Prasad 2,140 Reputation points
    2023-06-08T07:05:48.0166667+00:00

    Hi,

    To make cells uneditable based on specific dates and times, you can use a combination of conditional formatting and data validation in Excel. Here's how you can do it-

    1. Select the cells in row 1 (3 cells) that you want to restrict editing for.
    2. Go to the "Home" tab in the Excel ribbon and click on "Conditional Formatting" in the "Styles" group.
    3. Select "New Rule" from the dropdown menu. The "New Formatting Rule" dialog box will appear.
    4. Choose the option "Use a formula to determine which cells to format."
    5. In the "Format values where this formula is true" field, enter the following formula: =NOW() > DATE(2023,8,24)+TIME(18,0,0)
    6. Click on the "Format" button and go to the "Protection" tab. Check the box for "Locked" to lock the cells.
    7. Click "OK" to close the "Format Cells" dialog box, and then click "OK" again in the "New Formatting Rule" dialog box.
    8. Now, the selected cells in row 1 will be locked and uneditable after August 24, 2023, at 18:00.

    Repeat the above steps for each row, changing the formula to match the specific date and time for each row.

    Best Regards.

    1 person found this answer helpful.

  2. Tony S 15 Reputation points
    2023-06-13T11:20:48.1666667+00:00

    Thank you @Tanay Prasad that is great. I have manged to do that however I want to lock the cells based on the date and time of another cell.

    So for instance what you have said above will work however I would like a conditional formula based on the date and time of another cell.

    So the now is 06/13/2023 and the time is 12:12 however in the cell I want to lock based on the date and time of another cell is what I want to do .

    So the cells I want to lock are C3,D3,E3 but I dont want them to lock until the date and time has expired on cell F3 . In cell F3 I would manually input the date and time as 06/13/2023 time 12:20

    I would put the Now and Time into another cell say B1 so basically I want to lock C3,D3,E3, when the F3 cells goes past the B1 cell.User's image

    I hope that makes sense.


  3. Mr.Lee 0 Reputation points
    2024-01-07T05:25:00.56+00:00

    I think that can only be done using VBA

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.