Initialize data in new row?

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

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
 
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
 
Back
Top