ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel Macro - Keystroke (https://www.excelbanter.com/excel-discussion-misc-queries/234915-excel-macro-keystroke.html)

Eric

Excel Macro - Keystroke
 
Hi,

How do I integrate a keystroke on my recorded macro.. For instance...

I would like to create a macro which when you run, it automatically enters
the current time on a fixed cell. I know that ctrl+shift+; will enter the
current time in the cell but I cant seem to record that keystroke on a macro.

Thanks,
Eric

Luke M

Excel Macro - Keystroke
 
Rather than using keystrokes which is genearlly frowned upon (although it
could be done with SendKeys) simply have your macro state something like:

Range("A2") = TimeValue(Now)
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"eric" wrote:

Hi,

How do I integrate a keystroke on my recorded macro.. For instance...

I would like to create a macro which when you run, it automatically enters
the current time on a fixed cell. I know that ctrl+shift+; will enter the
current time in the cell but I cant seem to record that keystroke on a macro.

Thanks,
Eric


Eric

Excel Macro - Keystroke
 
works like a charm.. Thanks Luke!

"Luke M" wrote:

Rather than using keystrokes which is genearlly frowned upon (although it
could be done with SendKeys) simply have your macro state something like:

Range("A2") = TimeValue(Now)
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"eric" wrote:

Hi,

How do I integrate a keystroke on my recorded macro.. For instance...

I would like to create a macro which when you run, it automatically enters
the current time on a fixed cell. I know that ctrl+shift+; will enter the
current time in the cell but I cant seem to record that keystroke on a macro.

Thanks,
Eric


Luke M

Excel Macro - Keystroke
 
or simply,
Range("A2") = Time

"Now" is used if you need the date.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Luke M" wrote:

Rather than using keystrokes which is genearlly frowned upon (although it
could be done with SendKeys) simply have your macro state something like:

Range("A2") = TimeValue(Now)
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"eric" wrote:

Hi,

How do I integrate a keystroke on my recorded macro.. For instance...

I would like to create a macro which when you run, it automatically enters
the current time on a fixed cell. I know that ctrl+shift+; will enter the
current time in the cell but I cant seem to record that keystroke on a macro.

Thanks,
Eric



All times are GMT +1. The time now is 03:00 PM.

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