Cell input to call macro in adjacent cell

Closed
chris - Nov 17, 2009 at 07:30 AM
 Trowa - Nov 17, 2009 at 08:44 AM
Hello,

I have a scenario that i'd like automated. The scenario is as follows

If i enter a value in any cell in a particular column, i want the system time to be entered in the adjacent cell. Currently i have used this command in a macro to do it, but it is a manual process (ActiveCell.Value = Time) and i have to click on the adjacent cell and then press the shortcut buttons to do it every time.

eg.

If i enter 123 in cell A2, then i want the system time (eg. 6:59:33 PM) to be captured in cell B2. I want to continue entering values in the column 'A' one below the other with system time being automatically entered down to the second in the corresponding adjacent cell in column 'B'. Is this possible, it would be awesome if someone could help me.

Thanks!
Chris

1 response

Hi Chris,

Implement this code on the worksheet you want it to work on (right click on the worksheet tab, click on view code):

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveCell.Offset(-1, 1) = Time
End Sub

Whenever you put something in a cell and hit ENTER, the current system time is being put in the adjacent cell to the right.

NOTE that you have to confirm your entry by hitting ENTER and not use the arrows or TAB.

Best regards,
Trowa
0