+ Reply to Thread
Results 1 to 8 of 8

Locking cells when today's date is passed.

  1. #1
    Registered User
    Join Date
    03-27-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6

    Locking cells when today's date is passed.

    I am trying to write a VBA code that locks the cells when today's date is passed. In other words, I am trying to give the chance for the users to enter the needed data once in today's date, but to prevent them from amending this data later on.
    Any help?

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Locking cells when today's date is passed.

    Have you tried a data validation formula?

    I'm assuming 'today's' date is a hard coded date in a cell and you want to test the system date today against it. If not upload your workbook and give us a few examples of what entries are permitted and when.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    03-27-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Locking cells when today's date is passed.

    It crossed my mind to try the data validation, however, I am using a drop down list in almost all of my cells, so I don't think tow validation formulas can take place in one cell. You may please advise if this is possible.
    Below is exactly what I need the code to do.
    1- I created a cell that calculates the entry date using a code.
    2- The user has the permission to enter or edit any value in any cell for the first time.
    3- If the user wrote and saved his data, the entry date will automatically save the entry date so he can still have the permission to edit his data on the same day of writing it.
    4- If this day passed (TODAY), the user cant edit this data the next day but he can still add new data in a new row. In other words, if the user wrote new data in row 5 and saved it. Next day he will only have the possibility to write in empty cells only.
    Briefly, Data Entry that was made on 28/3/2014, can not be edited on 29/3/2014, but the user still can add new data in new cells if hewants.
    I attached the sheet as requested and I would appreciate it if you could help applying the code to ranges "A5:O1003"
    Thanks a lot.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-27-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Locking cells when today's date is passed.

    I am not sure if any one is trying to help here, or whether my post is clear enough or not?
    I may please ask once more for any one who can provide a faster solution as I am one day late in delivering my project.
    Thanks a lot and deeply sorry for posting again.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Locking cells when today's date is passed.

    Hi,

    We need to see some examples of what you want to see.

    There is no data entered on the sheets and you also have a MS Common Controls object referenced in VBA which I don't have and hence VBA debugs when I move around on the sheet.

    Please manually add some dates and suitably coloured cells which reflect the requirement as requested last time so that we can see the end goal and explain the rules that determine the colours with reference to specific cells.

  6. #6
    Registered User
    Join Date
    03-27-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Locking cells when today's date is passed.

    Hello,
    Thanks for you fast response.
    I attached the sheet once more with two rows filled in it.
    As you will see, there is a column named (Entry Date). This column run with a VBA code that generates the date automatically when all the corresponding columns are filled from (A5:M5). SO when the row 5 (For example) is filled with data, the code automatically generates with the entry date and remains the same even if the user closed and opened the sheet at any other date. Its not a "today()" function....
    In that case, the entry date in rows 5 & 6 is 28/3/2014 because I entered the data today.
    What I need to do is, when the user tries to edit those data after 28/3/2014, he receives an error message and the code prevents him from editing this data and at the same time the user has the option to write new data in other rows following those rows starting row 7.
    I hope this is clear for you and I hope if you can respond to me with a code as soon as possible.
    Thanks
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-27-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Locking cells when today's date is passed.

    Hi,

    Just to be precise for any one trying to help, what I need the code to do is simply:

    1- Users can only input data at empty cells.
    2- Users cannot edit old data after one day from writing them.
    3- Users should be able to edit their new data, on a condition that this data was entered on the same day of editing.

    Thanks.

  8. #8
    Registered User
    Join Date
    03-27-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Locking cells when today's date is passed.

    Hi,
    Is there any updates or any one who can help me.
    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Lock cells after Today's date passed (VBA excel code)
    By rt1306 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 05-16-2013, 12:06 PM
  2. I need to lock cells after date has passed on time shees.
    By Backsurge in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-20-2013, 01:24 AM
  3. Replies: 6
    Last Post: 08-23-2012, 12:14 PM
  4. Lock cells after today date passed
    By Abdul Haneef in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2012, 07:17 AM
  5. Lock cells after Today's date passed (VBA excel code)
    By rt1306 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-27-2009, 01:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1