worksheet change event issues

chadb1211

New Member
Joined
Feb 12, 2008
Messages
3
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
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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