PC Review


Reply
Thread Tools Rate Thread

Date Stamp in Last Column in active row if any data changes in row

 
 
Kokanutt
Guest
Posts: n/a
 
      20th Oct 2009
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 don’t 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

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      21st Oct 2009
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 don’t 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Stamp in one cell when data in other range changes =?Utf-8?B?U3RldmUgRQ==?= Microsoft Excel Programming 15 18th Dec 2009 12:46 PM
Data Collection Date Stamp AC Microsoft Access External Data 0 25th Jun 2009 12:15 AM
Adding a date stamp to each cell in column - after the fact joe54345@gmail.com Microsoft Excel Misc 1 24th Apr 2006 10:28 PM
date stamp Can I add a date stamp in a Text or Memo Field =?Utf-8?B?TWljaGFlbCBM?= Microsoft Access Database Table Design 10 11th Apr 2005 02:29 AM
bringing data from one workbook to another using a date stamp func =?Utf-8?B?dGlmb3NpMw==?= Microsoft Excel Worksheet Functions 0 5th Apr 2005 12:13 AM


Features
 

Advertising
 

Newsgroups
 


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