View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Entering static Date/Time

Had some formatting problems:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell as Range
If Target.Columns.Count 1 Then _
Exit Sub
If Target.Column < 1 Then _
Exit Sub
For Each cell In Target
If Not IsEmpty(cell) Then
Cells(Target.Row, "B").Value = Date
Cells(Target.Row, "C").Value = Time
Columns("B:C").AutoFit
End If
Next

End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count 1 Then Exit Sub
If Target.Column < 1 Then
Exit Sub
For Each cell In Target
If Not IsEmpty(cell) Then
Cells(Target.Row, "B").Value = Date
Cells(Target.Row, "C").Value = Time
Columns("B:C").AutoFit
End If
Next

End Sub

right click on the sheet tab and select view code. Paste in code like the
above.

--
Regards,
Tom Ogilvy

"GAMOSTEVE" wrote in message
...

I'm trying to enter a date and a time in a worksheet if there is data
entered into a particular cell. Example - Cell A contains data or null
- if data, enter current date in Cell B and current time in cell C.

Problem I keep running into, the date/time updates to current with data
entry into the next row.

Anyone have any ideas?


--
GAMOSTEVE
------------------------------------------------------------------------
GAMOSTEVE's Profile:

http://www.excelforum.com/member.php...o&userid=14762
View this thread:

http://www.excelforum.com/showthread...hreadid=263848