Code help.

K

Ken

All,

Can anyone provide some code that will allow me to enter
the current time into the active cell? I know the shortcut
Ctrl+Shift+Colon will enter the time in the cell, but I
would like to create a time button in this workbook, and
link this macro to it so the user will just have to select
the cell and hit the button to enter the current time. Can
anyone help? Thanks in advance!
 
R

Richard Choate

ActiveCell = Format(Now(), "h:mm AM/PM")

Richard Choate

All,

Can anyone provide some code that will allow me to enter
the current time into the active cell? I know the shortcut
Ctrl+Shift+Colon will enter the time in the cell, but I
would like to create a time button in this workbook, and
link this macro to it so the user will just have to select
the cell and hit the button to enter the current time. Can
anyone help? Thanks in advance!
 
A

acw

Ken

try
ActiveCell.Value = WorksheetFunction.Text(Now(), "h:mm
AM/PM")

You will have to nominate the cell to put it in - this is
just to give you an idea for syntax.

Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top