Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Date recording on a cell

I have only an average skill level in Excel, but I have a good amout of skill
with Access and VBA.
I was wondering if there was a way to automatically record the present date
when a cell data is entered/changed. This date can be stored in the comments
field or in another cell.

I know the user could just enter the date in another cell manually but I
have been asked to make this an automatic process by my boss.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date recording on a cell

Hi Miley,

Try:

'=============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim rng2 As Range
Dim rCell As Range

Set rng = Range("A1:A20") '<<==== CHANGE

Set rng2 = Intersect(rng, Target)

If Not rng2 Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
For Each rCell In rng2.Cells
With rCell
If Not IsEmpty(.Value) Then
.Offset(0, 1).Value = Now
.Offset(0, 1).NumberFormat = "mm/dd/yy h:mm"
Else
.Offset(0, 1).Value = ""
End If
End With
Next rCell
End If
XIT:
Application.EnableEvents = True
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


"Mikey B" wrote in message
...
I have only an average skill level in Excel, but I have a good amout of
skill
with Access and VBA.
I was wondering if there was a way to automatically record the present
date
when a cell data is entered/changed. This date can be stored in the
comments
field or in another cell.

I know the user could just enter the date in another cell manually but I
have been asked to make this an automatic process by my boss.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Date recording on a cell

Thanks alot Norman. That works perfectly.
Your "You're the Man" plaque is in the mail. :)

"Norman Jones" wrote:

Hi Miley,

Try:

'=============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim rng2 As Range
Dim rCell As Range

Set rng = Range("A1:A20") '<<==== CHANGE

Set rng2 = Intersect(rng, Target)

If Not rng2 Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
For Each rCell In rng2.Cells
With rCell
If Not IsEmpty(.Value) Then
.Offset(0, 1).Value = Now
.Offset(0, 1).NumberFormat = "mm/dd/yy h:mm"
Else
.Offset(0, 1).Value = ""
End If
End With
Next rCell
End If
XIT:
Application.EnableEvents = True
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


"Mikey B" wrote in message
...
I have only an average skill level in Excel, but I have a good amout of
skill
with Access and VBA.
I was wondering if there was a way to automatically record the present
date
when a cell data is entered/changed. This date can be stored in the
comments
field or in another cell.

I know the user could just enter the date in another cell manually but I
have been asked to make this an automatic process by my boss.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro - a way of recording the date Sarah (OGI) Excel Worksheet Functions 3 August 1st 07 02:32 PM
Recording the date another cell is edited or modified. Ed Excel Worksheet Functions 2 December 2nd 06 03:22 AM
recording a data entry date Rusty 1i Excel Worksheet Functions 1 July 8th 06 06:18 PM
recording the date when record was entered in cell in Excel mcgoo Excel Worksheet Functions 1 February 10th 05 10:11 PM
Recording the last saved date of an external file in a cell Mickey Mouse[_4_] Excel Programming 1 September 5th 03 09:29 AM


All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"