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/430043-how-make-auto-date-update-work-range-cells.html)

cashnic

how to make auto date update work on a range of cells.
 
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

John Bundy

how to make auto date update work on a range of cells.
 
You were telling it to only do it for a particular cell address. You can do
it with the entire column D with this:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then 'D is the 4th column
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy hh:mm")
End If
End Sub
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"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


Gord Dibben

how to make auto date update work on a range of cells.
 
You asked this same question an hour ago and received the same answer you
just got here.

Why did I bother an hour ago?


Gord Dibben MS Excel MVP

On Thu, 18 Jun 2009 09:20:15 -0700, 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.
 
Sorry Gord, it was not intentional. I have not used this tool before and was
not sure whether I should ask my question as "new" or from an existing
string. My apologies, I appreciate the help!

"Gord Dibben" wrote:

You asked this same question an hour ago and received the same answer you
just got here.

Why did I bother an hour ago?


Gord Dibben MS Excel MVP

On Thu, 18 Jun 2009 09:20:15 -0700, 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




Gord Dibben

how to make auto date update work on a range of cells.
 
The first time you asked was within another thread.

When you do that, don't start a new thread without waiting a while to see if
you get a response.

Sometimes you won't because people think that old thread was finished.

The you post a new thread.

We'll let you off this time since you are new here<g


Gord

On Thu, 18 Jun 2009 11:50:01 -0700, cashnic
wrote:

Sorry Gord, it was not intentional. I have not used this tool before and was
not sure whether I should ask my question as "new" or from an existing
string. My apologies, I appreciate the help!

"Gord Dibben" wrote:

You asked this same question an hour ago and received the same answer you
just got here.

Why did I bother an hour ago?


Gord Dibben MS Excel MVP

On Thu, 18 Jun 2009 09:20:15 -0700, 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 11:37 AM.

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