ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   change the Date in cell B2 if changes are made (https://www.excelbanter.com/excel-worksheet-functions/176009-change-date-cell-b2-if-changes-made.html)

Steved

change the Date in cell B2 if changes are made
 
Hello from Steved

I'm using excel 2007

I would like a formula please to change the date in Cell B2 if I make
changes to the data in the worksheet the range is C2:F550

Thankyou.

Gary''s Student

change the Date in cell B2 if changes are made
 
Paste the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("C2:F550")
If Intersect(r, Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("B2").Value = Date
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200768


"Steved" wrote:

Hello from Steved

I'm using excel 2007

I would like a formula please to change the date in Cell B2 if I make
changes to the data in the worksheet the range is C2:F550

Thankyou.


Steved

change the Date in cell B2 if changes are made
 
Hello Gary from Steved

Firstly Thankyou, Gary I'm only allowed one instance off Worksheet_Change
because if I use 2 or more in the same work sheet I get

"ambiguous name detected:Worksheet_Change"

Can you please think off a solution or is this not possible yes I've already
got one and using your code makes it 2.

Thankyou.



"Gary''s Student" wrote:

Paste the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("C2:F550")
If Intersect(r, Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("B2").Value = Date
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200768


"Steved" wrote:

Hello from Steved

I'm using excel 2007

I would like a formula please to change the date in Cell B2 if I make
changes to the data in the worksheet the range is C2:F550

Thankyou.



All times are GMT +1. The time now is 09:17 AM.

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