run time error 1004 range of object _worksheet failed when creating automatic timestamp

crozy 1 Reputation point
2022-02-17T10:02:07.127+00:00

this is my first time using VBA so i am unable to solve this issue.

Im trying to create an automatic Timestamp for my excel document. The timestamp shows the input time and updated time in columns "AY" and "AZ", when any cell in the table is updated. However, the code works fine on my own computer, but once i share the document to my colleagues, they get:

"run time error 1004 range of object _worksheet failed"
Below is the code i use:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim MyTableRange As Range
Dim myDateTimeRange As Range
Dim myUpdatedRange As Range

Set MyTableRange = Range("A4:AZ100")

If Intersect(Target, MyTableRange) Is Nothing Then Exit Sub

Set myDateTimeRange = Range("AY" & Target.Row)
Set myUpdatedRange = Range("AZ" & Target.Row)

If myDateTimeRange.Value = "" Then

myDateTimeRange.Value = Now
 

End If

myUpdatedRange.Value = Now

End Sub

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,849 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.