ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to make auto date update work on a range of cells. (https://www.excelbanter.com/excel-programming/430038-re-how-make-auto-date-update-work-range-cells.html)

Jacob Skaria

how to make auto date update work on a range of cells.
 
Try the below

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("D:D")) Is Nothing Then
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy hh:mm")
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"cashnic" wrote:

Sorry, very new to formulas and code. The code below will populate a cell
with the update date/time when the cell next to it is updated. Works
GREAT...on that one cell! How do I apply this code to an entire column? I'm
sure I need to enter a range of cells somehow into this code but I don't know
how to do this.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$7" Then
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy hh:mm")
End If
End Sub


cashnic

how to make auto date update work on a range of cells.
 
Perfect! works great.

Now I see why my husband gets sooo excited about Excel...it's so cool when
it works.

Nicole

"Jacob Skaria" wrote:

Try the below

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("D:D")) Is Nothing Then
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy hh:mm")
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"cashnic" wrote:

Sorry, very new to formulas and code. The code below will populate a cell
with the update date/time when the cell next to it is updated. Works
GREAT...on that one cell! How do I apply this code to an entire column? I'm
sure I need to enter a range of cells somehow into this code but I don't know
how to do this.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$7" Then
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy hh:mm")
End If
End Sub



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

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