Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Evgeny
 
Posts: n/a
Default Date when I last change cell in a row?

Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular row.
This way I will know when exactly I last updated the information for client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular

row.
This way I will know when exactly I last updated the information for

client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,




  #3   Report Post  
Dan Morton
 
Posts: n/a
Default

I have a similar need and this looked like it should work for me but I
couldn't get it to work perhaps you can tell me what I'm did incorrectly.

I inserted the code as indicated into the sheet's code area. Is there
anything else I have to do to get it to execute?

assumed Me.Range ("H1") was the indicated which column to put the date in
and chaged H1 to Z1 since column Z is where i need the date to go

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular

row.
This way I will know when exactly I last updated the information for

client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,





  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Did you enable macros when you opened the workbook
Check tools|macro|security|security level
If it's set to not ask and not run macros, then you could have problems.

(Change it to medium to always prompt you (what version of excel are you
using?))

Bob's code looks for changes in row 5. Is that what you wanted?

You may want to look at how JE McGimpsey does it (just for comparison):
http://www.mcgimpsey.com/excel/timestamp.html

But it's difficult to guess.

Dan Morton wrote:

I have a similar need and this looked like it should work for me but I
couldn't get it to work perhaps you can tell me what I'm did incorrectly.

I inserted the code as indicated into the sheet's code area. Is there
anything else I have to do to get it to execute?

assumed Me.Range ("H1") was the indicated which column to put the date in
and chaged H1 to Z1 since column Z is where i need the date to go

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular

row.
This way I will know when exactly I last updated the information for

client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,






--

Dave Peterson
  #5   Report Post  
Dan Morton
 
Posts: n/a
Default

Macros are enabled. I wasn't aware that as coded only row 5 was checked.
What I want to do is insert the current date in column Z of any row that
changes have been made in. Any Idea how to mod code to accomplish that; it
should be fairly obvious I don't. Thanks.

"Dave Peterson" wrote:

Did you enable macros when you opened the workbook
Check tools|macro|security|security level
If it's set to not ask and not run macros, then you could have problems.

(Change it to medium to always prompt you (what version of excel are you
using?))

Bob's code looks for changes in row 5. Is that what you wanted?

You may want to look at how JE McGimpsey does it (just for comparison):
http://www.mcgimpsey.com/excel/timestamp.html

But it's difficult to guess.

Dan Morton wrote:

I have a similar need and this looked like it should work for me but I
couldn't get it to work perhaps you can tell me what I'm did incorrectly.

I inserted the code as indicated into the sheet's code area. Is there
anything else I have to do to get it to execute?

assumed Me.Range ("H1") was the indicated which column to put the date in
and chaged H1 to Z1 since column Z is where i need the date to go

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular
row.
This way I will know when exactly I last updated the information for
client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,






--

Dave Peterson



  #6   Report Post  
Gord Dibben
 
Posts: n/a
Default

Dan

Private Sub Worksheet_Change(ByVal Target As Range)
'for any column or row with Z as receiver of date
On Error GoTo enditall
Application.EnableEvents = False
If Not IsEmpty(Cells(Target.Row, "Z")) Then Exit Sub
If Not IsEmpty(Target.Value) Then Cells(Target.Row, "Z") = Now
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben Excel MVP

On Fri, 30 Sep 2005 09:36:02 -0700, "Dan Morton"
wrote:

Macros are enabled. I wasn't aware that as coded only row 5 was checked.
What I want to do is insert the current date in column Z of any row that
changes have been made in. Any Idea how to mod code to accomplish that; it
should be fairly obvious I don't. Thanks.

"Dave Peterson" wrote:

Did you enable macros when you opened the workbook
Check tools|macro|security|security level
If it's set to not ask and not run macros, then you could have problems.

(Change it to medium to always prompt you (what version of excel are you
using?))

Bob's code looks for changes in row 5. Is that what you wanted?

You may want to look at how JE McGimpsey does it (just for comparison):
http://www.mcgimpsey.com/excel/timestamp.html

But it's difficult to guess.

Dan Morton wrote:

I have a similar need and this looked like it should work for me but I
couldn't get it to work perhaps you can tell me what I'm did incorrectly.

I inserted the code as indicated into the sheet's code area. Is there
anything else I have to do to get it to execute?

assumed Me.Range ("H1") was the indicated which column to put the date in
and chaged H1 to Z1 since column Z is where i need the date to go

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular
row.
This way I will know when exactly I last updated the information for
client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,






--

Dave Peterson


  #7   Report Post  
Dave Peterson
 
Posts: n/a
Default

Just to add to Gord's response.

His code says to not update column Z if it already has something in it. So if
you change A1 today (then Z1 will be populated with that moment's date/time.)

But if you change B1 tomorrow (and haven't touched Z1), then Z1 will remain with
the initial date.

This is the line that says first change wins:
If Not IsEmpty(Cells(Target.Row, "Z")) Then Exit Sub

If you want every change to overwrite the date/time in column Z, just delete
that line.

Gord Dibben wrote:

Dan

Private Sub Worksheet_Change(ByVal Target As Range)
'for any column or row with Z as receiver of date
On Error GoTo enditall
Application.EnableEvents = False
If Not IsEmpty(Cells(Target.Row, "Z")) Then Exit Sub
If Not IsEmpty(Target.Value) Then Cells(Target.Row, "Z") = Now
enditall:
Application.EnableEvents = True
End Sub

Gord Dibben Excel MVP

On Fri, 30 Sep 2005 09:36:02 -0700, "Dan Morton"
wrote:

Macros are enabled. I wasn't aware that as coded only row 5 was checked.
What I want to do is insert the current date in column Z of any row that
changes have been made in. Any Idea how to mod code to accomplish that; it
should be fairly obvious I don't. Thanks.

"Dave Peterson" wrote:

Did you enable macros when you opened the workbook
Check tools|macro|security|security level
If it's set to not ask and not run macros, then you could have problems.

(Change it to medium to always prompt you (what version of excel are you
using?))

Bob's code looks for changes in row 5. Is that what you wanted?

You may want to look at how JE McGimpsey does it (just for comparison):
http://www.mcgimpsey.com/excel/timestamp.html

But it's difficult to guess.

Dan Morton wrote:

I have a similar need and this looked like it should work for me but I
couldn't get it to work perhaps you can tell me what I'm did incorrectly.

I inserted the code as indicated into the sheet's code area. Is there
anything else I have to do to get it to execute?

assumed Me.Range ("H1") was the indicated which column to put the date in
and chaged H1 to Z1 since column Z is where i need the date to go

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular
row.
This way I will know when exactly I last updated the information for
client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,






--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Dan Morton
 
Posts: n/a
Default

Thanks, code you provided does exactly what I needed.
Dan Morton

"Dave Peterson" wrote:

Just to add to Gord's response.

His code says to not update column Z if it already has something in it. So if
you change A1 today (then Z1 will be populated with that moment's date/time.)

But if you change B1 tomorrow (and haven't touched Z1), then Z1 will remain with
the initial date.

This is the line that says first change wins:
If Not IsEmpty(Cells(Target.Row, "Z")) Then Exit Sub

If you want every change to overwrite the date/time in column Z, just delete
that line.

Gord Dibben wrote:

Dan

Private Sub Worksheet_Change(ByVal Target As Range)
'for any column or row with Z as receiver of date
On Error GoTo enditall
Application.EnableEvents = False
If Not IsEmpty(Cells(Target.Row, "Z")) Then Exit Sub
If Not IsEmpty(Target.Value) Then Cells(Target.Row, "Z") = Now
enditall:
Application.EnableEvents = True
End Sub

Gord Dibben Excel MVP

On Fri, 30 Sep 2005 09:36:02 -0700, "Dan Morton"
wrote:

Macros are enabled. I wasn't aware that as coded only row 5 was checked.
What I want to do is insert the current date in column Z of any row that
changes have been made in. Any Idea how to mod code to accomplish that; it
should be fairly obvious I don't. Thanks.

"Dave Peterson" wrote:

Did you enable macros when you opened the workbook
Check tools|macro|security|security level
If it's set to not ask and not run macros, then you could have problems.

(Change it to medium to always prompt you (what version of excel are you
using?))

Bob's code looks for changes in row 5. Is that what you wanted?

You may want to look at how JE McGimpsey does it (just for comparison):
http://www.mcgimpsey.com/excel/timestamp.html

But it's difficult to guess.

Dan Morton wrote:

I have a similar need and this looked like it should work for me but I
couldn't get it to work perhaps you can tell me what I'm did incorrectly.

I inserted the code as indicated into the sheet's code area. Is there
anything else I have to do to get it to execute?

assumed Me.Range ("H1") was the indicated which column to put the date in
and chaged H1 to Z1 since column Z is where i need the date to go

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular
row.
This way I will know when exactly I last updated the information for
client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,






--

Dave Peterson


--

Dave Peterson

  #9   Report Post  
Dan Morton
 
Posts: n/a
Default

Thanks for your help with change suggested by Dave the code you suggested
does exactly what I needed.
Dan

"Gord Dibben" wrote:

Dan

Private Sub Worksheet_Change(ByVal Target As Range)
'for any column or row with Z as receiver of date
On Error GoTo enditall
Application.EnableEvents = False
If Not IsEmpty(Cells(Target.Row, "Z")) Then Exit Sub
If Not IsEmpty(Target.Value) Then Cells(Target.Row, "Z") = Now
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben Excel MVP

On Fri, 30 Sep 2005 09:36:02 -0700, "Dan Morton"
wrote:

Macros are enabled. I wasn't aware that as coded only row 5 was checked.
What I want to do is insert the current date in column Z of any row that
changes have been made in. Any Idea how to mod code to accomplish that; it
should be fairly obvious I don't. Thanks.

"Dave Peterson" wrote:

Did you enable macros when you opened the workbook
Check tools|macro|security|security level
If it's set to not ask and not run macros, then you could have problems.

(Change it to medium to always prompt you (what version of excel are you
using?))

Bob's code looks for changes in row 5. Is that what you wanted?

You may want to look at how JE McGimpsey does it (just for comparison):
http://www.mcgimpsey.com/excel/timestamp.html

But it's difficult to guess.

Dan Morton wrote:

I have a similar need and this looked like it should work for me but I
couldn't get it to work perhaps you can tell me what I'm did incorrectly.

I inserted the code as indicated into the sheet's code area. Is there
anything else I have to do to get it to execute?

assumed Me.Range ("H1") was the indicated which column to put the date in
and chaged H1 to Z1 since column Z is where i need the date to go

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Row = 5 Then
Me.Range("H1").Value = Date
Me.Range("H1").NumberFormat = "dd-mmm-yyyy"
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Evgeny" wrote in message
...
Please, Help.
In my database, every row represents a separate client. I wonder if it is
possible to input the date when I last changed any value in a particular
row.
This way I will know when exactly I last updated the information for
client
in row 4, 5 etc.
I don't need the date when the document was last saved.
Please, let me know if it can be done in Excel.

Thank you,






--

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
change cell shading whenever contents different from previous cell zooeyhallne Excel Discussion (Misc queries) 3 June 6th 05 09:59 PM
Cell references change when entering new data [email protected] New Users to Excel 2 May 6th 05 07:48 PM
How do I change the value in cell based on a future date John W Excel Discussion (Misc queries) 2 December 21st 04 01:27 AM
Using formulas to determine date in one cell based on date in anot Gary Excel Worksheet Functions 2 November 22nd 04 08:11 AM
Extract date from cell Eric Excel Worksheet Functions 3 November 4th 04 06:37 PM


All times are GMT +1. The time now is 04:01 PM.

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

About Us

"It's about Microsoft Excel"