Initialize data in new row?

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
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top