+ Reply to Thread
Results 1 to 3 of 3

Use check box to time stamp, lock and disable checkbox after initial click.

  1. #1
    Registered User
    Join Date
    09-30-2010
    Location
    Fort Lauderdale, Florida
    MS-Off Ver
    Excel 2007
    Posts
    3

    Use check box to time stamp, lock and disable checkbox after initial click.

    Hi I'm a newbie to VBA and need some help please. I'm trying to put together an electronic Time Card, so to speak. I would like to have a checkbox for "time in", one for "out to lunch", one for "back from lunch" and one "end of day". The idea is when any of these checkboxes is checked it would unlock the cell next to it and put a static time stamp in it, then lock it again and disable the check box from being clicked again. This way the employees cannot change the entry once the checkbox is checked. In addition, the 2nd checkbox should only be enabled if the first one is checked, the 3rd checkbox should be enabled if the 1st and 2nd are checked off, and so on. I've tried many different options, macros, itirations and I'm having trouble with code since I'm new to it. Any help is greatly appreciate it.

  2. #2
    Registered User
    Join Date
    09-30-2010
    Location
    Fort Lauderdale, Florida
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Use check box to time stamp, lock and disable checkbox after initial click.

    Here's what I've been able to piece together as of now. It works partially. It doesn't disable the checkbox but it does lock it which prevents it from being clicked again. I get an error the second time I click on the checkbox.

  3. #3
    Registered User
    Join Date
    09-30-2010
    Location
    Fort Lauderdale, Florida
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Use check box to time stamp, lock and disable checkbox after initial click.

    Sub Time_s()

    Dim c As Range

    For Each c In Range("g6")
    If c.Value = True Then
    c.Offset(0, 1).Value = Format(Now, "hh:mm")
    ActiveSheet.Unprotect
    Range("g6:i6").Select
    Selection.Locked = True
    Selection.FormulaHidden = True
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    Else
    ActiveSheet.Unprotect
    Range("g6:h6").Select
    Selection.Locked = False
    Selection.FormulaHidden = False
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

    End If
    Next


    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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