putting dates next to entries

  • Thread starter Thread starter peter
  • Start date Start date
P

peter

I don't know Excel too well. I have a running spreadsheet with new
entries each day. Is there a way that I can have Excel automatically
put the date in the next column? Whenever a cell in entered or
modified, it would enter that date in the next cell.


Thanks,

Peter
 
Hi Peter:

The easy way to enter the date is to click on the cell and type CNTRL ;

It can be done automatically, but that requires VBA coding
 
Peter

This would require event code behind the worksheet.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value <> "" Then
Excel.Range("B" & n).Value = Date
End If
End If
enditall:
Application.EnableEvents = True
End Sub

To implement this..............

Right-click on the sheet tab and "View Code".

Copy/paste the above event code into that module.

Whenever you enter or edit data in any cell in column A, the date will be
entered in column B


Gord Dibben Excel MVP
 
Hey Gord, that worked real well for columns a and b. How do I do it
if I need the same thing in other coulmns?

Thanks!

Peter
 
Peter

That would depend upon what your "other columns" are and where you would like
to have the timestamp entered.

In the code provided, you could change the Target.Cells.Column = 1 to another
column number.

The "A" and "B" can be altered.

Have a look at John McGimpsey's site on this subject.

http://www.mcgimpsey.com/excel/timestamp.html

Specifically the DateTimeStamp Macro which can be called by event code.

Gord
 

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

Similar Threads

Excel Vba to change displayed year automatically. 14
Excel Date Setting 1
Access Problem using dates in a query in access 0
Excel Dragging countif formula with changing criteria 3
today's date static 1
Excel Import Comments 3
Excel 2 into 1 6
Excel VBA to move cells to sheet2 based on selection in sheet1 0

Back
Top