Block cell to change after a certain time.

  • Hello,


    Please help me with the following problem.
    In a password protected spreadsheet that can be accessed by multiple users (each accessing a certain range), we need the cell C3, can no longer be changed after 2 pm. How can I do that? Thank You.

  • Re: Block cell to change after a certain time.


    hope this helps...


    Code
    ActiveSheet.Unprotect "Pass"
    If Format(Now(), "HH:MM:SS  AM/PM") < "2:00:00 PM" Then Range("C3").Locked = True
    ActiveSheet.Protect "Pass"
  • Re: Block cell to change after a certain time.


    Thanks ashu1990


    Unable to make the code work. In this file working after 14.00 (add new data always) and I would like to C3 cell can not be changed after 14:00, but to be able to enter data file. Worksheet_Activate but I tried did not work. Can you help me? Thank You.

  • Re: Block cell to change after a certain time.


    Try this


    Code
    Option Explicit
    '
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Const PW As String = "Secret" '??? enter your password here
        If Target.Address = ("$C$3") And Time > "14:00:00" Then
            Me.Unprotect PW
            Target.Locked = True
            Me.Protect PW
        End If
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!