+ Reply to Thread
Results 1 to 9 of 9

Locked worksheet based upon date and locked columns when worksheet is not locked

  1. #1
    Registered User
    Join Date
    05-04-2011
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Locked worksheet based upon date and locked columns when worksheet is not locked

    I am creating a spreadsheet with multipl worksheets (12 to be exact, one for each month). On the 7th of the month after the worksheet locks for user editing. (2/7/2011 the January worksheet was locked). I do this by protecting all the sheets before close and then at open call for protectsheet to do a date check and unprotect the necessary tables. In the unprotected sheets I need to lock columns E, H, K and L. I am wondering is I should change a code or add something to do this and I can't figure out what to do. Any help would be greatly appreciated.

    Workbook code currently being used:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by ruralbrew; 05-04-2011 at 03:48 PM.

  2. #2
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    Hi, I have a solution for your problem, but before I can give it to you.You will need to edit your post and use code tags per the forum rules.

    Place this before the first line of code [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE]


    Thank You, Mike
    Last edited by Leith Ross; 05-04-2011 at 11:06 AM.

  3. #3
    Registered User
    Join Date
    05-04-2011
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    My apologies. I must have missed that. I have updated the post. Thank you in advance.

  4. #4
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    Not a problem,

    Here is a test book,see if it works for you.
    Thank You, Mike
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-04-2011
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    It appears to work except the April and May sheets should be ulocked now because it is prior to the 7th of May and therefore April would still be open. After the 7th of the month it would lock the previous months worksheet and only allow you to edit the current months sheet.

    By the way, thanks. This is great.

  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    Here is a new version to try:

    This will keep all the worksheet protected at all times:

    If the worksheet is in the current Month the user will be able to input data for the ranges you specified.
    or
    if the date is within 7 days or less in the current month worksheet, the previous months worksheet will be able to let the user input data.

    However Columns "E,H,K,L" the user will not be able to edit.

    Let me know how it works out.

    Thank You, Mike


    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-04-2011
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    This appears as if this works. Thanks for your help. This is great.

    Thank you,

    Jarrod

  8. #8
    Registered User
    Join Date
    05-04-2011
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    Should I be able to unprotect a sheet (by right clicking on the worksheet and clicking uprotect sheet) without entering a password? The code looks like it is using a password, but it allows me to unlock without a password.

  9. #9
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Locked worksheet based upon date and locked columns when worksheet is not locked

    Hi,
    My Bad...

    This should do the trick:

    Mike
    Attached Files Attached Files

+ 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