View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default auto enter date when another cell populated?

You need a macro, try this. right click on the sheet where you want this to
happen and paste this code in.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("C1:C65536"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, -2)
.NumberFormat = "dd mmm yyyy"
.Value = Now
End With
With .Offset(0, -1)
.NumberFormat = "hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

Was that OK?

Mike

"zim" wrote:

I have an s/sheet with order data: I need to create a macro or formula so
that when data is entered into i.e. Column C, the date is automatically
entered into Column A and the time into Column B. The dates / times need to
remain static / constant and not update when the file is reopened. Any
suggestions? (I've tried an = If(isblank etc.)... with Ctrl+; and
Ctrl+Shift+; but my date defaults to 1/1/00). Thanks for your help!

--
zim