Hi guys, i have slight issue with my code.
here is the scoop. when something in column E2:E35 changes i want excel to
put the date & time in column y of that row.
the code works if the user pushes tab after entering data but if the user presses return or enter it actually enters the date & time in the next row.
i am guessing my worksheet_change event only fires after pressing enter and therefore the current row is actually the the row +1 instead of the row where data was entered. What event should i move this to to have it fire while the user is inputting or before moving to the next row? thanks
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rownumber
rownumber = Selection.Row
If Not Intersect(Range("e2:e35"), Target) Is Nothing Then
Range("y" & rownumber).Value = Date & " " & Time
'MsgBox "A1 has changed"
End If
End Sub
here is the scoop. when something in column E2:E35 changes i want excel to
put the date & time in column y of that row.
the code works if the user pushes tab after entering data but if the user presses return or enter it actually enters the date & time in the next row.
i am guessing my worksheet_change event only fires after pressing enter and therefore the current row is actually the the row +1 instead of the row where data was entered. What event should i move this to to have it fire while the user is inputting or before moving to the next row? thanks
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rownumber
rownumber = Selection.Row
If Not Intersect(Range("e2:e35"), Target) Is Nothing Then
Range("y" & rownumber).Value = Date & " " & Time
'MsgBox "A1 has changed"
End If
End Sub