ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Automatically entering time and date to an entry (https://www.excelbanter.com/excel-discussion-misc-queries/112675-automatically-entering-time-date-entry.html)

Ashlee

Automatically entering time and date to an entry
 
How would I go about getting Excel to automatically attach the current date
and time to every entry i make? I am trying to form a phone log, and instead
of manually typing in the time and date of every phone call I record, I
wanted to see if there was any way it could be filled in automatically.

Don Guillett

Automatically entering time and date to an entry
 
You could use a worksheet_change event in the sheet module

target.offset(,1)=date
target.offset(,2)=time

--
Don Guillett
SalesAid Software

"Ashlee" wrote in message
...
How would I go about getting Excel to automatically attach the current
date
and time to every entry i make? I am trying to form a phone log, and
instead
of manually typing in the time and date of every phone call I record, I
wanted to see if there was any way it could be filled in automatically.




Gord Dibben

Automatically entering time and date to an entry
 
Ashlee

Use event code in 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 = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that module.

As written, date/time into B whenever a value is entered in A(column 1)


Gord Dibben MS Excel MVP

On Tue, 3 Oct 2006 12:23:01 -0700, Ashlee
wrote:

How would I go about getting Excel to automatically attach the current date
and time to every entry i make? I am trying to form a phone log, and instead
of manually typing in the time and date of every phone call I record, I
wanted to see if there was any way it could be filled in automatically.




All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com