Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 135
Default Insert date when data is modified

I have rows of data that I will periodically update. What I want to do is
have a cell at the end of the row that shows the date when data in just that
row was last updated.
For example, the rows might look like this:
13 42 23 45 90 ModifyDateRow1
52 32 97 74 37 ModifyDateRow2

I assumed I could do it with VBA, but when I tried to write it, I found that
I wasn't sure how to proceed. The code I tried is below, but the TODAY
function doesn't work ("Object doesn't support this property or method.").

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
If Not (Application.Intersect(Target, Range("A1:E20")) Is Nothing) Then
With WS.Cells(Target.Row, 6)
.Value = Application.WorksheetFunction.Today()
.NumberFormat = "mm/dd/yyyy"
End With
Exit Sub
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,440
Default Insert date when data is modified

Look he

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

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Horatio J. Bilge, Jr." wrote in message
...
|I have rows of data that I will periodically update. What I want to do is
| have a cell at the end of the row that shows the date when data in just that
| row was last updated.
| For example, the rows might look like this:
| 13 42 23 45 90 ModifyDateRow1
| 52 32 97 74 37 ModifyDateRow2
|
| I assumed I could do it with VBA, but when I tried to write it, I found that
| I wasn't sure how to proceed. The code I tried is below, but the TODAY
| function doesn't work ("Object doesn't support this property or method.").
|
| Option Explicit
| Private Sub Worksheet_Change(ByVal Target As Range)
| Dim WS As Worksheet
| Set WS = Worksheets("Sheet1")
| If Not (Application.Intersect(Target, Range("A1:E20")) Is Nothing) Then
| With WS.Cells(Target.Row, 6)
| .Value = Application.WorksheetFunction.Today()
| .NumberFormat = "mm/dd/yyyy"
| End With
| Exit Sub
| End If
| End Sub
|


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Insert date when data is modified

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
If Not (Application.Intersect(Target, Range("A1:E20")) Is Nothing) Then
With WS.Cells(Target.Row, 6)
.Value = Format(Date, "mm/dd/yyyy")

End With
Exit Sub
End If
End Sub


Gord Dibben MS Excel MVP

On Tue, 23 Oct 2007 13:37:01 -0700, Horatio J. Bilge, Jr.
wrote:

I have rows of data that I will periodically update. What I want to do is
have a cell at the end of the row that shows the date when data in just that
row was last updated.
For example, the rows might look like this:
13 42 23 45 90 ModifyDateRow1
52 32 97 74 37 ModifyDateRow2

I assumed I could do it with VBA, but when I tried to write it, I found that
I wasn't sure how to proceed. The code I tried is below, but the TODAY
function doesn't work ("Object doesn't support this property or method.").

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
If Not (Application.Intersect(Target, Range("A1:E20")) Is Nothing) Then
With WS.Cells(Target.Row, 6)
.Value = Application.WorksheetFunction.Today()
.NumberFormat = "mm/dd/yyyy"
End With
Exit Sub
End If
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 135
Default Insert date when data is modified

Thanks. That worked well.
~ Horatio

"Gord Dibben" wrote:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
If Not (Application.Intersect(Target, Range("A1:E20")) Is Nothing) Then
With WS.Cells(Target.Row, 6)
.Value = Format(Date, "mm/dd/yyyy")

End With
Exit Sub
End If
End Sub


Gord Dibben MS Excel MVP

On Tue, 23 Oct 2007 13:37:01 -0700, Horatio J. Bilge, Jr.
wrote:

I have rows of data that I will periodically update. What I want to do is
have a cell at the end of the row that shows the date when data in just that
row was last updated.
For example, the rows might look like this:
13 42 23 45 90 ModifyDateRow1
52 32 97 74 37 ModifyDateRow2

I assumed I could do it with VBA, but when I tried to write it, I found that
I wasn't sure how to proceed. The code I tried is below, but the TODAY
function doesn't work ("Object doesn't support this property or method.").

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
If Not (Application.Intersect(Target, Range("A1:E20")) Is Nothing) Then
With WS.Cells(Target.Row, 6)
.Value = Application.WorksheetFunction.Today()
.NumberFormat = "mm/dd/yyyy"
End With
Exit Sub
End If
End Sub



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
insert the date the file was last modified Ted M H Excel Discussion (Misc queries) 5 September 2nd 07 03:28 PM
insert the date the file was last modified Hoff Excel Discussion (Misc queries) 8 November 21st 05 01:31 PM
Insert date modified of external file flaterp Excel Discussion (Misc queries) 1 October 26th 05 08:45 PM
How do I insert date modified in an Excel document? Josh Brewster Excel Discussion (Misc queries) 6 October 15th 05 01:26 AM
EXCEL - is there a way to insert "date modified" into Scuda Excel Worksheet Functions 1 January 7th 05 07:52 PM


All times are GMT +1. The time now is 12:01 AM.

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"