ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code - if T changed, change date in W to date it is changed (https://www.excelbanter.com/excel-programming/272747-code-if-t-changed-change-date-w-date-changed.html)

Sandy[_3_]

Code - if T changed, change date in W to date it is changed
 
Hello!

I need code that if a value in T is changed, the date in
the corresponding row of W will change to the date it is
changed.

Any help I can get will be immensely appreciated!

Sandy

Chip Pearson

Code - if T changed, change date in W to date it is changed
 
Sandy,

Put the following code in the sheet module for the worksheet whose
changes you want to detect.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then
Exit Sub
End If
If Target.Column < 20 Then
Exit Sub
End If
Target(1, 4).Value = Now
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Sandy" wrote in message
...
Hello!

I need code that if a value in T is changed, the date in
the corresponding row of W will change to the date it is
changed.

Any help I can get will be immensely appreciated!

Sandy




Sandy[_3_]

Code - if T changed, change date in W to date it is changed
 
Dear Chip:

Thanks for your response. Works well, although I don't
understand exactly how it works. Could you briefly
describe what it's doing? I'm rusty in my VBA at the
moment.

Can this be taken one step further so that essentially,
clicking on the cell is not enough to change it, but the
actual change of the value will institute the date change?

Sandy

-----Original Message-----
Sandy,

Put the following code in the sheet module for the

worksheet whose
changes you want to detect.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then
Exit Sub
End If
If Target.Column < 20 Then
Exit Sub
End If
Target(1, 4).Value = Now
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Sandy" wrote in message
...
Hello!

I need code that if a value in T is changed, the date in
the corresponding row of W will change to the date it is
changed.

Any help I can get will be immensely appreciated!

Sandy



.



All times are GMT +1. The time now is 04:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com