Thread: Time Stamp
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Time Stamp

You can use a macro that calls this macro:

Option Explicit
Sub Testme()
Call DateTimeStamp(ChangedCells:=ActiveCell, _
IncludeDate:=True, _
IncludeTime:=True, _
DTFormat:="dd mmm yyyy hh:mm", _
RowOffset:=0&, _
ColOffset:=0&, _
ClearWhenEmpty:=True)
End Sub



jrm wrote:

Hi! how do i "stamp" the macro to an active cell? I used the code you
suggested:

Public Sub DateTimeStamp(ByVal ChangedCells As Range, _
Optional ByVal IncludeDate As Boolean = True, _
Optional ByVal IncludeTime As Boolean = True, _
Optional ByVal DTFormat As String = "dd mmm yyyy hh:mm", _
Optional ByVal RowOffset As Long = 0&, _
Optional ByVal ColOffset As Long = 1&, _
Optional ByVal ClearWhenEmpty As Boolean = True)
Const n1904 As Long = 1462
Dim bClear As Boolean
Dim rArea As Range
Dim rCell As Range

Application.EnableEvents = False
For Each rArea In ChangedCells.Areas
For Each rCell In rArea
With rCell
bClear = ClearWhenEmpty And IsEmpty(.Value)
With .Offset(RowOffset, ColOffset)
If bClear Then
.ClearContents
Else
.NumberFormat = DTFormat
.Value = Date * -IncludeDate - _
Time * IncludeTime + _
n1904 * .Parent.Parent.Date1904
End If
End With
End With
Next rCell
Next rArea
Application.EnableEvents = True
End Sub

I copied this to a module but it wont show up when i try to recall it using
alt+f8 or by trying to attach it to a button? How do i use this?

"JE McGimpsey" wrote:

see

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


In article ,
Kenny wrote:

I am using the following code to create a time stamp in a cell. I am using
the code so that the date will remain static. Problem is even when you clear
an entry or apply formatting in a cell in column a; it applys a new time
stamp to column 5. How can I change this code to only update when the cell is
entered with data?

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
Target.Offset(0, 5).Value = Date + 10
End If



--

Dave Peterson