Lock date

Paul Norris

Board Regular
Joined
Feb 20, 2011
Messages
96
Hi all

I am trying to figure out how to lock a cell date automatically after the user saves changes, it's current format it is a tick box with a reference cell Today() but it need to be locked once completed, any ideas ???
Thanks in advance

Paul
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi all

I am trying to figure out how to lock a cell date automatically after the user saves changes, it's current format it is a tick box with a reference cell Today() but it need to be locked once completed, any ideas ???
Thanks in advance

Paul

When necessary to save the date, copy the cell and paste the value. ;)
 
Upvote 0
Try Vba below

Code:
Sub UnlockMe()
    Dim cl As Range
    Sheets("Sheet1").Unprotect Password:="Genie"
    For Each cl In ActiveSheet.UsedRange.Cells
        If CDate(cl) < CDate(Date) And Not (cl.Value = vbNullString) Then
            cl.Locked = True
        Else
             cl.Locked = False
        End If
    Next cl
    Sheets("Sheet1").Protect Password:="Genie"
End Sub
 
Upvote 0
Try Vba below

Code:
Sub UnlockMe()
    Dim cl As Range
    Sheets("Sheet1").Unprotect Password:="Genie"
    For Each cl In ActiveSheet.UsedRange.Cells
        If CDate(cl) < CDate(Date) And Not (cl.Value = vbNullString) Then
            cl.Locked = True
        Else
             cl.Locked = False
        End If
    Next cl
    Sheets("Sheet1").Protect Password:="Genie"
End Sub



Perfect thanks
 
Upvote 0

Forum statistics

Threads
1,207,402
Messages
6,078,263
Members
446,324
Latest member
JKamlet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top