#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jiwolf
 
Posts: n/a
Default time stamp

Anybody know how to time stamp a file? I need to execute a macro to insert
the date and time into a cell ( say cell A1). This cell has then to be
locked until a password is entered.

Any help greatly appreciated



Pete


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JE McGimpsey
 
Posts: n/a
Default time stamp

One way:

Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sPWORD As String = "drowssap"
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
.Parent.Unprotect Password:=sPWORD
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
.Locked = True
.Parent.Protect Password:=sPWORD
Application.EnableEvents = True
End If
End With
End Sub




See

http://www.mcgimpsey.com/excel/timestamp.html

for additional ideas.

In article ,
"jiwolf" wrote:

Anybody know how to time stamp a file? I need to execute a macro to insert
the date and time into a cell ( say cell A1). This cell has then to be
locked until a password is entered.

Any help greatly appreciated



Pete

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jiwolf
 
Posts: n/a
Default time stamp

thanks for the code, but how do I run the macro?
"JE McGimpsey" wrote in message
...
One way:

Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sPWORD As String = "drowssap"
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
.Parent.Unprotect Password:=sPWORD
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
.Locked = True
.Parent.Protect Password:=sPWORD
Application.EnableEvents = True
End If
End With
End Sub




See

http://www.mcgimpsey.com/excel/timestamp.html

for additional ideas.

In article ,
"jiwolf" wrote:

Anybody know how to time stamp a file? I need to execute a macro to
insert
the date and time into a cell ( say cell A1). This cell has then to be
locked until a password is entered.

Any help greatly appreciated



Pete



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default time stamp

You don't explicitly run it. It's an event macro that's always hanging around
waiting for you to change something in A2:A10.

If you didn't follow J.E.'s instructions (putting the code behind the
worksheet), then move the code there.

If you did follow his instructions and the event doesn't fire, then make sure
you open excel with macros enabled.

Or maybe you just have to change the range from A2:A10 to something else???

jiwolf wrote:

thanks for the code, but how do I run the macro?
"JE McGimpsey" wrote in message
...
One way:

Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sPWORD As String = "drowssap"
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
.Parent.Unprotect Password:=sPWORD
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
.Locked = True
.Parent.Protect Password:=sPWORD
Application.EnableEvents = True
End If
End With
End Sub




See

http://www.mcgimpsey.com/excel/timestamp.html

for additional ideas.

In article ,
"jiwolf" wrote:

Anybody know how to time stamp a file? I need to execute a macro to
insert
the date and time into a cell ( say cell A1). This cell has then to be
locked until a password is entered.

Any help greatly appreciated



Pete


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jiwolf
 
Posts: n/a
Default time stamp

ah, doh!


"Dave Peterson" wrote in message
...
You don't explicitly run it. It's an event macro that's always hanging
around
waiting for you to change something in A2:A10.

If you didn't follow J.E.'s instructions (putting the code behind the
worksheet), then move the code there.

If you did follow his instructions and the event doesn't fire, then make
sure
you open excel with macros enabled.

Or maybe you just have to change the range from A2:A10 to something
else???

jiwolf wrote:

thanks for the code, but how do I run the macro?
"JE McGimpsey" wrote in message
...
One way:

Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sPWORD As String = "drowssap"
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
.Parent.Unprotect Password:=sPWORD
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
.Locked = True
.Parent.Protect Password:=sPWORD
Application.EnableEvents = True
End If
End With
End Sub




See

http://www.mcgimpsey.com/excel/timestamp.html

for additional ideas.

In article ,
"jiwolf" wrote:

Anybody know how to time stamp a file? I need to execute a macro to
insert
the date and time into a cell ( say cell A1). This cell has then to be
locked until a password is entered.

Any help greatly appreciated



Pete


--

Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate Date & Time differences robs Excel Worksheet Functions 2 October 4th 05 04:22 PM
Time and motion chart deant Charts and Charting in Excel 0 September 21st 05 08:22 AM
Excel Time Manipulation BFiedler Excel Discussion (Misc queries) 0 September 15th 05 01:15 AM
help with date and time wayne visser Excel Worksheet Functions 1 June 14th 05 04:10 PM
Time Sheets Lady Layla Excel Discussion (Misc queries) 1 March 23rd 05 03:22 PM


All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"