ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   input current time (https://www.excelbanter.com/excel-programming/340095-input-current-time.html)

KimR.Hammel[_2_]

input current time
 
How can I get Excel to automatically input the current time when a cell is
selected? Also, upon selecting the cell again, the time must be removed.

Vacation's Over

input current time
 
from help

Now()
Numbers to the right of the decimal point in the serial number represent the
time; numbers to the left represent the date. For example, the serial number
..5 represents the time 12:00 noon

in a formula it will always recalculate so you need to tie to an event.

Easiest would be to viewtoolbarscontrol toolbox - selexct a command button
and add this to your spreadsheet. tie the code to clicking the box instead
of the cell and tie the results to the cell.


"KimR.Hammel" wrote:

How can I get Excel to automatically input the current time when a cell is
selected? Also, upon selecting the cell again, the time must be removed.


KimR.Hammel[_2_]

input current time
 
I was going to paste =NOW(), then copy paste special value upon
activation of the cell. I don't know how to get it to do something upon
activation of the cell, however.

"Vacation's Over" wrote:

from help

Now()
Numbers to the right of the decimal point in the serial number represent the
time; numbers to the left represent the date. For example, the serial number
.5 represents the time 12:00 noon

in a formula it will always recalculate so you need to tie to an event.

Easiest would be to viewtoolbarscontrol toolbox - selexct a command button
and add this to your spreadsheet. tie the code to clicking the box instead
of the cell and tie the results to the cell.


"KimR.Hammel" wrote:

How can I get Excel to automatically input the current time when a cell is
selected? Also, upon selecting the cell again, the time must be removed.


Vacation's Over

input current time
 
My preference for adding a touch of programming would be to add a command
button to the sheet, click the button & it changes cell value to current time.

Viewtoolbars controls toolbox
choose design view
click command button and then click,smalldrag - drop to size and locate the
button
right click the button
add this code after changing "A4" to desired cell for time

Activesheet.Range("A4").Value = Now()

close the VBE window

format your "A4" to desired time/date accuracy and style
exit design mode
close controls toolbox

click away & watch A4 change

"KimR.Hammel" wrote:

I was going to paste =NOW(), then copy paste special value upon
activation of the cell. I don't know how to get it to do something upon
activation of the cell, however.

"Vacation's Over" wrote:

from help

Now()
Numbers to the right of the decimal point in the serial number represent the
time; numbers to the left represent the date. For example, the serial number
.5 represents the time 12:00 noon

in a formula it will always recalculate so you need to tie to an event.

Easiest would be to viewtoolbarscontrol toolbox - selexct a command button
and add this to your spreadsheet. tie the code to clicking the box instead
of the cell and tie the results to the cell.


"KimR.Hammel" wrote:

How can I get Excel to automatically input the current time when a cell is
selected? Also, upon selecting the cell again, the time must be removed.



All times are GMT +1. The time now is 12:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com