more about time stamping

S

sunroyal

Can I make a current time stamp in a cell that is triggered by checkin
a box?


Thanks, Lane

Also...the time must remain as it was when entered, [not =now()]
 
B

Bob Phillips

Hi Lane,

Add this code to the sheet code module. Duble-clicking coilumn A will put
the date in column B

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
With Target
If .Column = 1 Then
If .Value = "" Then
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Value = Date
Else
.Value = ""
.Offset(0, 1).Value = ""
End If
.Offset(0, 1).Activate
End If
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
J

Jeff

How does this need to be modified if I want to add a date
stamp (say in b1) when I make a change to the contents in
a1. the date should only change when I make a change to
a1.

Is there an easier way?

How can this be changed so that a date stamp is added to
column b for any corresponding column a cell that is
changed (e.g., if a2 then b2, a9 then b9, etc.)

thank you

Jeff
-----Original Message-----
Hi Lane,

Add this code to the sheet code module. Duble-clicking coilumn A will put
the date in column B

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
With Target
If .Column = 1 Then
If .Value = "" Then
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Value = Date
Else
.Value = ""
.Offset(0, 1).Value = ""
End If
.Offset(0, 1).Activate
End If
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Can I make a current time stamp in a cell that is triggered by checking
a box?


Thanks, Lane

Also...the time must remain as it was when entered, [not =now()].


.
 
D

Dave Peterson

I'd use something like this:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub

Application.EnableEvents = False

On Error GoTo errHandler:
With Target.Offset(0, 1)
.Value = Now 'date
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With

errHandler:
Application.EnableEvents = True
End Sub

(I used date and time. Modify it to what you want to show.)


How does this need to be modified if I want to add a date
stamp (say in b1) when I make a change to the contents in
a1. the date should only change when I make a change to
a1.

Is there an easier way?

How can this be changed so that a date stamp is added to
column b for any corresponding column a cell that is
changed (e.g., if a2 then b2, a9 then b9, etc.)

thank you

Jeff
-----Original Message-----
Hi Lane,

Add this code to the sheet code module. Duble-clicking coilumn A will put
the date in column B

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
With Target
If .Column = 1 Then
If .Value = "" Then
.Value = "a"
.Font.Name = "Marlett"
.Offset(0, 1).Value = Date
Else
.Value = ""
.Offset(0, 1).Value = ""
End If
.Offset(0, 1).Activate
End If
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Can I make a current time stamp in a cell that is triggered by checking
a box?


Thanks, Lane

Also...the time must remain as it was when entered, [not =now()].


.
 
Top