ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can you perform ctrl+shift+; in a macro to display time? (https://www.excelbanter.com/excel-discussion-misc-queries/65802-can-you-perform-ctrl-shift-%3B-macro-display-time.html)

Darran Parsons

Can you perform ctrl+shift+; in a macro to display time?
 
I would like to add current but static time to a cell within a larger macro,
but the only way I can find to enter just the time and not date as well is to
use ctrl+shift+; but it doesn't appear that macro allow the use of hardkeys,
although my knowledge of macros is basic i'm sure there must be a work around.

Norman Jones

Can you perform ctrl+shift+; in a macro to display time?
 
Hi Darran

Try:

'=============
Public Sub TesterC()

With Range("A1")
.Value = Time
.NumberFormat = "h:mm AM/PM"
End With
End Sub

'<<=============



---
Regards,
Norman


"Darran Parsons" <Darran wrote in message
...
I would like to add current but static time to a cell within a larger
macro,
but the only way I can find to enter just the time and not date as well is
to
use ctrl+shift+; but it doesn't appear that macro allow the use of
hardkeys,
although my knowledge of macros is basic i'm sure there must be a work
around.





All times are GMT +1. The time now is 06:26 PM.

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