+ Reply to Thread
Results 1 to 7 of 7

Conditional locking based on time value entered in another cell

  1. #1
    Registered User
    Join Date
    05-24-2017
    Location
    El Paso, Texas
    MS-Off Ver
    2007
    Posts
    2

    Lightbulb Conditional locking based on time value entered in another cell

    Hi there,

    Here is what I'm trying to accomplish and can't seem to solve:

    If I enter a time value such as "3:00 am" in cell A1, then 24 hours (or a different configurable period of time) after that time, I'd like cell B1 to be automatically locked so that a value cannot be entered. The cell lock should be password protected so that it can be manually unlocked by a password holder as desired.

    Any help would be appreciated!

    Thank you,
    Jacob

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,354

    Re: Conditional locking based on time value entered in another cell

    What's a cell lock? By default, cells are all locked but that has no effect unless the Worksheet is password protected. What happens if macros are not enabled?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Conditional locking based on time value entered in another cell

    We need to know a little more. Is it only Cell B1 you want locked or is it anything in Column B with a date / time in Column A? Entering 3 AM isn't enough. It also needs to be accompanied with a date. Otherwise it's 3 AM on January 1st, 1900. This task could probably be accomplished with a workbook open event at a minimum for times that expired between workbook saves. I'd probably use a Selection Change event to see if the currently-selected cell is still editable.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Registered User
    Join Date
    05-24-2017
    Location
    El Paso, Texas
    MS-Off Ver
    2007
    Posts
    2

    Re: Conditional locking based on time value entered in another cell

    Hi there,

    I've attached a mock-up of what I'm trying to accomplish. By "lock" I mean disallow manual entry of a value after a certain amount of time. The point of this is to prevent someone from entering a value as "completed" outside of the expected completion time (24 hours).

    Does this make sense or do you need additional information.

    Thank you,
    Jacob
    Attached Files Attached Files

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Conditional locking based on time value entered in another cell

    I noticed that you put in 3:00 AM, January 1st, 1900. A time alone is not good enough data. You also need to enter a date: e.g. 5/25/2017 3:00 AM.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Conditional locking based on time value entered in another cell

    Here is my shot at it. When you enter a time in Column B, the program automatically adds the date in Cell B1 to the time (unless you enter a date and time in the cell - in which case, it accepts it). This means the application is pretty much limited to a single date.

    The second part of the program kicks in when you select a cell in column B to update. If it is within the time specified by Cell B1 on the control panel sheet, you can change it. If it is "expired" the cell is locked and you can't change it.

    This spreadsheet makes use of locked cells and protecting the sheet. I have unlocked all cells in Columns A and B. Column B cells will get locked as appropriate. If you need other cells unlocked, you are on your own.
    Attached Files Attached Files

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Conditional locking based on time value entered in another cell

    P.S. If you are going to use this as a template, unprotect the sheet. Select the range of cells containing this test data and delete the contents. The program doesn't fire if more than one cell in column B is selected. Then you can edit the sheet with new tasks and times. The sheet will re-protect when the first date is entered. The program also doesn't try to lock the cell if the date cell is blank, it will only add the date to whatever time you enter.

+ 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. Creating a cell that time stamps based on entered information
    By Cethard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2016, 03:37 PM
  2. Conditional formatting based on entered dated and how much time has passed
    By sanchez7315 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2012, 12:07 AM
  3. Replies: 9
    Last Post: 01-23-2010, 09:21 AM
  4. Locking cells depending on what is entered in another cell
    By nujwaan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-23-2009, 08:35 AM
  5. Replies: 0
    Last Post: 05-25-2009, 06:58 PM
  6. Conditional locking of cell based on another cell
    By jman0707 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-12-2008, 09:39 AM
  7. Conditional locking of cell based on another cell
    By jman0707 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2008, 08:29 AM

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