+ Reply to Thread
Results 1 to 7 of 7

Lock cells for input if dat has passed

  1. #1
    Registered User
    Join Date
    01-26-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    4

    Lock cells for input if dat has passed

    I have a monthly file of data which I want to automatically lock for changes after a certain date.
    In cell A1 I have the date that today needs to be equal to or less than. ie if today is greater than cell A1 I want to lock cells for changes.
    Is there a way to do this ( Sorry I am no VBA expert!)
    Many Thanks

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Lock cells for input if dat has passed

    This could be adapted
    Please Login or Register  to view this content.
    Worksheet event code is stored on a worksheet module. To add it to your worksheet, do the following:

    Copy the code
    Select the worksheet in which you the code to run
    Right click on the sheet tab and choose View Code, to open the Visual Basic Editor.
    Where the cursor is flashing, choose Edit | Paste
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    01-26-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Lock cells for input if dat has passed

    Hi RoyUk
    Thanks for prompt reply. So say If todays date was after date in cell A1 I wanted to lock entry to cells range C1 to HH250 I would try the code:

    --------------------
    Please Login or Register  to view this content.
    I have tried above code but it doesnt seem to do anything. Apologies, I have no VBA experience!
    Many Thanks
    Kevin :-)
    Last edited by royUK; 11-09-2011 at 10:51 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Lock cells for input if dat has passed

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  5. #5
    Registered User
    Join Date
    01-26-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Lock cells for input if dat has passed

    Thanks for prompt reply. So say If todays date was after date in cell A1 I wanted to lock entry to cells range C1 to HH250 I would try the code:

    Please Login or Register  to view this content.
    I have tried above code but it doesnt seem to do anything. Apologies, I have no VBA experience!
    Many Thanks
    Kevin :-)

  6. #6
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Lock cells for input if dat has passed

    If you have no other data validation in your range, you can also apply a data validation to your cells.

    See the attached.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-26-2011
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Lock cells for input if dat has passed

    Fantastic Whizzbang - works a treat!! Many Thanks!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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