Should be Easy Time Date Issue

R

RubberSoul

I dont mean to insult anyones intelligence, but I am new to Excel.
would like to double click a cell and have the current PC time and dat
to enter the cell. Is this possible?

Thank you
 
G

Gary Brown

How about...
Shift-Ctrl-;
(Hold down the Shift key and the Ctrl key, then press the semi-colon key)
This enters the time. Then format the cell for Date/Time
HTH,
Gary Brown
 
P

Paul B

RubberSoul,

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
ActiveCell = Now
End Sub

To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. Now when you double click in a cell on that sheet
it will put in the data and time. If you are using excel 2000 or newer you
may have to change the macro security settings to get the macro to run. To
change the security settings go to tools, macro, security, security level
and set it to medium


you can also put in the date and time form the key board like this

Current date press CTRL+;(semi-colon) then press ENTER.

Current time press CTRL+SHIFT+; (semi-colon) then press ENTER.


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
G

Gary Brown

I misspoke about the shift-ctrl-;
It gives the wrong date.

If you put the following code into the 'ThisWorkbook' module of your
workbook, it will work...

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As _
Object, ByVal Target As Range, Cancel As Boolean)

ActiveCell.FormulaR1C1 = Now()

Selection.NumberFormat = "mm/dd/yyyy hh:mm AM/PM"

End Sub

HTH,
Gary Brown
 
Top