Dates
Through what?
The event code for a non-shared worksheet?
NOTE: will not work on a Shared Workbook as I said earlier.
1. Select column A and any other range you want unlocked.
2. FormatCellsProtection uncheck the "locked" box.
3. Widen column A to about 16 minimum.
Select the sheet tab and "View Code". Copy/paste this code into that sheet
module.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target _
As Range, Cancel As Boolean)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
ActiveSheet.Unprotect Password:="justme"
For Each cell In Target
If cell.Value = "" Then
With cell
.Value = Now
.Locked = True
End With
End If
Next
Cancel = True
End If
enditall:
Application.EnableEvents = True
ActiveSheet.Protect Password:="justme"
End Sub
Double-click on any blank cell in column A and get the date/time entered and
cell locked so timestamp cannot be changed.
Does not affect protection on other unlocked cells.
"justme" can be any password you choose.
You will of course want to lock the code from prying eyes so..........
Alt + F11 to open Visual Basic Editor.
Select your workbook/project and right-clickVBAProject
PropertiesProtectionLock for Viewing. Apply a password and save/close the
workbook.
When re-opened, code will be unviewable or uneditable.
Gord
On Tue, 6 Feb 2007 11:35:03 -0800, Ms. Beasley
wrote:
Can you walk me through that? Thanks!
"Gord Dibben" wrote:
Ms Beasley
Many features are unavailable in Shared Workbooks.
See Help on "shared workbook" for a list.
Changing protection/locking/unlocking cell is one of these features not
available.
What you want to do can easily be done on a non-shared workbook using event
code.
Gord
On Tue, 6 Feb 2007 09:35:01 -0800, Ms. Beasley
wrote:
What I've been asked to do is create a shared log sheet that will allow users
to click in a blank cell that will automatically populate today's date and
then lock the cell. Then tomorrow when it is opened it will still show the
date of yesterday's entry into the log sheet. I am not proficient at Excel
at all!!! Thanks so much!!
"Ms. Beasley" wrote:
I'm trying to do a worksheet that will autotmatically enter "today's date" in
a field but will not update when the spreadsheet is opened tomorrow. Can
anybody help me with this? Thanks!
|