View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Initialize data in new row?

Like a timestamp

right click on the worksheet and insert code like this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Row < 1 And Target.Column < 1 Then
If IsEmpty(Cells(Target.Row, 1)) Then
On Error GoTo ErrHandler
Application.EnableEvents = True
Cells(Target.Row, 1).Value = Date
Cells(Target.Row, 1).NumberFormat = "mm/dd/yyyy"
End If
End If
ErrHandler:
Application.EnableEvents = True
End Sub


--
Regards,
Tom Ogilvy

Ken wrote in message
om...
Hi. When data is entered into a new row, I want to initialize a value
into one of the row's cells. How would I do that?

Thanks!

Ken