Worksheet change does not happen

dkirk500

New Member
Joined
May 11, 2020
Messages
13
Office Version
  1. 2016
Platform
  1. MacOS
Guys ,

I used this simple code to track the changes made in worksheet( sheet7) using timestamp. The code only works if i change the cell value within sheet 7. However i have a data entry form on sheet6 which data goes to sheet 7. If i make any changes from sheet6 , timestamp does not happen. There are no issues of data changes between sheet 6 and sheet 7. What am I doing wrong here?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)


Dim myTableRange As Range
Dim myDateTimeRange As Range
Dim myUpdatedRange As Range


Set myTableRange = Sheet7.Range("A4:r9999")

If Intersect(Target, myTableRange) Is Nothing Then Exit Sub
Application.EnableEvents = False

Set myDateTimeRange = Range("v" & Target.Row)
Set myUpdatedRange = Range("w" & Target.Row)

If myDateTimeRange.Value = "" Then
    myDateTimeRange.Value = Now
End If

myUpdatedRange.Value = Now

Application.EnableEvents = True
End Sub
 
Last edited by a moderator:
Indeed its not. :). On a fresh workbook i used two sheets (1 &2) to replicate the problem. On sheet1 cell A1 , i just put a test value. On sheet 2 , cell A1, i used =sheet1!A1 to copy the data ( there wasn't any code) and used the worksheet change code to see if it works. It does not like i stated above However it works when i directly change the value in the sheet 2 range (specified on worksheet change code), it works. Hope it explains.
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I already said at the start that formulas do not trigger worksheet_change
 
Upvote 0
Thanks. I think that was the issue. I just made one more test to confirm the theory to directly put formula on sheet2, it did not work. I was in an impression that simple copying is not part of the formula. . I have to put it on calculate events then?
 
Upvote 0
I apologise , I responded the earlier message too fast ( i choose the the wrong range to run the test as my code range is A4:R9999, so obviously when i used a formula in A1, it did not work. The formula actually triggers the change on sheet 2. If you have few mins, you could replicate the issue and see it yourself. I sincerely appreciate your times.
 
Upvote 0
Entering a formula initially will trigger a change event. If the result of that formula subsequently changes, that will not trigger a change event. It is not clear to me exactly what you are doing to each sheet currently.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top