+ Reply to Thread
Results 1 to 2 of 2

Auto lock after date

Hybrid View

Kingofthemoon Auto lock after date 02-27-2009, 05:02 PM
mrice Re: Auto lock after date 02-28-2009, 08:16 AM
  1. #1
    Registered User
    Join Date
    02-27-2009
    Location
    San Jose
    MS-Off Ver
    Excel 2003
    Posts
    1

    Auto lock after date

    Maybe this is so easy that no one writes about it, but I am trying to make a time sheet that students fill out themselves for a school program. I have the date next to a blank cell that they will update with the time they worked for that day, but I want it to to lock after the day is over. Than the next day they write a new amount of hours in another blank cell next to the date and it closes at the end of that day. At the end of the week I check the hours and sign off on them, so I don't want anyone updating the hours afterward. Any idea? I need to keep the entire semester on one page. I have little sections of weekdays in columns. First week is E8-E12, next week is G9-G12. There are twenty weeks. How would I do it for this? Or an entire worksheet? If you need anymore information please ask. Thanks a lot for the help!
    Last edited by VBA Noob; 02-27-2009 at 05:04 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Auto lock after date

    You could use something like..

    Sub Auto_Open()
    Sheets("Sheet1").Activate
    ActiveSheet.Unprotect
    For N = 5 To 7 Step 2
        For M = 8 To 12
            If Date > Cells(7, N) + M - 8 Then
                Cells(M, N).Locked = True
            End If
        Next M
    Next N
    ActiveSheet.Protect
    End Sub
    The entry cells would all start off as unlocked and gradually be locked over time.

    You might want to add a password and then protect the project with a password to prevent students seeing the password in the code.

+ 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