Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Stamp in Last Column in active row if any data changes in row

I would like a date/time stamp macro for excel spreadsheet. I have a
situation where I need for a date stamp to be enter automatically in the AG
column of the row if any changes were made in that row. I took a suggestion
from the web and got example A: but it put the stamp 31 columns to the right
of the cell being edited; so I tried example B:, but in order for this to
work I would have to enter ElseIfs for hundreds of rows and I dont want to
talk about if I add a new column. Did I mention I have over 12 sheets this
needs to done on? Please help! If you can. Thanks

A:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:AE10000"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 31).ClearContents
Else
With .Offset(0, 31)
.NumberFormat = "mm/dd/yyyy"
.Value = Date
End With
End If
Application.EnableEvents = True
End If
End With
End Sub


B:
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(.Cells, Me.Range("A2:AF10000")) Is Nothing Then
Application.EnableEvents = False
'With .Offset(0, 1)
With Range("AG2")
..Value = Now
..NumberFormat = "dd/mm/yy hh:mm AM/PM"

With Range("E2")
..Value = " "
End With
End With
End If

ws_exit:
Application.EnableEvents = True
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Date Stamp in Last Column in active row if any data changes in row

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Me.Range("A2:AE10000"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
me.cells(.row,"AG").ClearContents
Else
With me.cells(.row,"AG")
.NumberFormat = "mm/dd/yyyy"
.Value = Date
End With
End If
Application.EnableEvents = True
End If
End With
End Sub




Kokanutt wrote:

I would like a date/time stamp macro for excel spreadsheet. I have a
situation where I need for a date stamp to be enter automatically in the AG
column of the row if any changes were made in that row. I took a suggestion
from the web and got example A: but it put the stamp 31 columns to the right
of the cell being edited; so I tried example B:, but in order for this to
work I would have to enter ElseIfs for hundreds of rows and I dont want to
talk about if I add a new column. Did I mention I have over 12 sheets this
needs to done on? Please help! If you can. Thanks

A:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:AE10000"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 31).ClearContents
Else
With .Offset(0, 31)
.NumberFormat = "mm/dd/yyyy"
.Value = Date
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

B:
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(.Cells, Me.Range("A2:AF10000")) Is Nothing Then
Application.EnableEvents = False
'With .Offset(0, 1)
With Range("AG2")
.Value = Now
.NumberFormat = "dd/mm/yy hh:mm AM/PM"

With Range("E2")
.Value = " "
End With
End With
End If

ws_exit:
Application.EnableEvents = True
End With
End Sub


--

Dave Peterson
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
Date Stamp in one cell when data in other range changes Steve E Excel Programming 15 December 18th 09 12:46 PM
Macro or formula to date stamp cell based on new data input spideylobster Excel Programming 2 May 13th 09 07:57 PM
Trigger a Date & Time stamp by entering data in another field... mjjohnso Excel Worksheet Functions 4 April 11th 09 06:46 PM
Adding a date stamp to each cell in column - after the fact [email protected] Excel Discussion (Misc queries) 1 April 24th 06 10:28 PM
bringing data from one workbook to another using a date stamp func tifosi3 Excel Worksheet Functions 0 April 5th 05 12:13 AM


All times are GMT +1. The time now is 02:11 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"