# Buttons in excel sheet to insert current time



## sgundrum (Jan 11, 2005)

I work at a call center and i've developed a spreadsheet to keep track on my calls. The information I have is ticket number, store number, who called, issue, if it was web or phone based call, resolution. I want to add 3 more fields. One would be start of call. The next would be end of call. The last would be the difference between the two.

What I need to do is have 2 buttons I can press that will insert the current time into the correct cell.

IE: I want cell a1 to be start of call. a2 end of call. a3 difference. Then start all over with b1, b2 ,b3, etc.

Does any of this make sense? I know there is a key combo to do this, but it needs to easy enough for a caveman to use. 

Any help is greatly appreciated.

Thanks,

sgundrum


----------



## hopper (May 21, 2005)

You can record a macro that inserts the date into the active cell. Once you have the macro, you can open the forms toolbar and insert your buttons. Then associate the buttons to your macros.


----------



## sgundrum (Jan 11, 2005)

I tried that already and was only able to get it to insert the time that the macro was created.


----------



## hopper (May 21, 2005)

OK, I'll look into it further tonight when I have time. I'm in and out all day, but I'd like to figure it out too. Sorry I can't do it off the top of my head (which is empty today).


----------



## ReeKorl (Mar 25, 2005)

ok, Make a new button, go into edit mode and double click on it to bring up the VBA editing window. Inside the right-hand pane, you'll need to add the following line:


```
[color=blue]ActiveCell.Value = Time()[/color]
```
This will put the current time into the cell you currently have selected whenever you click on the button (after you come out of edit mode that is). Additionally, you can rename the button to something like "Timestamp" instead of "CommandButton1" inside the VBA editor.

If this doesn't make sense, post back and I'll walk you through it step by step.


----------



## sgundrum (Jan 11, 2005)

Thanks for the help. This worked great!


----------

