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:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
However i have a data entry form on sheet6 which data goes to sheet 7

If you mean that there are formulas on sheet 7 that link to the data on sheet 6, then those will not trigger the Worksheet_Change event. Formula recalculations trigger the Worksheet_Calculate event.
 
Upvote 0
There are no formulas. Just cell references such as sheet6.range("A5").value = sheet7("A5").value used in command button on sheet 6.
 
Upvote 0
Then that should work unless your other code disables events while it's processing.
 
Upvote 0
I actually tried to a completely new workbook. Fresh sheet nothing but A1 (sheet1) , and sheet2.A1=sheet1!a1 value and I still get the same problem.
 
Upvote 0
In the Immediate window type ?application.enableevents and press Enter. Does it return False?
 
Upvote 0
Can you post the actual code you have, since what you posted just now is clearly not the real code? Also, just as a long shot, do you have any conditional formatting that uses UDFs?
 
Upvote 0
It does not have any conditional formatting. I am sorry, which real code you are referring? The code is above the post and below i showed the outcome of ?application.enableevents in immediate browser.
 
Upvote 0
“sheet2.A1=sheet1!a1 value” is not valid code ;)
 
Upvote 0

Forum statistics

Threads
1,214,534
Messages
6,120,080
Members
448,943
Latest member
sharmarick

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