Troubleshooting timestamp and User name Cell Entry

0

Trying to get this code to work, had a previous answer but did not work. Wanted to post another question so that I could submit my workbook to show that I'm entering it correct or not?

I have an attachment that I asked a previous question about how to return the user that is editing that Row and place it in Column Q. I also want to return the date and time stamp like in your last video in Row O and P. (My data will be in Cell Range A2:J1500)

Private Sub Worksheet_Change(ByVal Target As Range)
'Timestamp Data
'   TeachExcel.com

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

'Your data table range
Set myTableRange = Range("A2:J1500")

'Check if the changed cell is in the data tabe or not.
If Intersect(Target, myTableRange) Is Nothing Then Exit Sub

'Column for the date/time
Set myDateTimeRange = Range("P" & Target.Row)
'Column for last updated date/time
Set myUpdatedRange = Range("O" & Target.Row)

'Stop events from running
Application.EnableEvents = False

'Determine if the input date/time should change
If myDateTimeRange.Value = "" Then

    myDateTimeRange.Value = Now

End If

'Update the updated date/time value
myUpdatedRange.Value = Now

'Update cell with username - 1 = Column A; 2 = Column B; etc.
Cells(Target.Row, 17).Value = Application.UserName

'Turn events back on
Application.EnableEvents = True
End Sub
Answer
Discuss

Discussion

I don't see any issues here. It looks good to me. Is it running ok now?
don (rep: 1492) Jun 26, '18 at 9:36 pm
Looks like it is working now! Thank you so much for all your time and hard work!
Sroncey21 (rep: 32) Jun 26, '18 at 9:41 pm
Yea, feel lucky I couldn't sleep tonight ;) Anyway, have a good one and let us know if you run into any other snags along the way!
don (rep: 1492) Jun 26, '18 at 9:55 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login