Code help.

  • Thread starter Thread starter Ken
  • Start date Start date
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!
 
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!
 
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
 
Back
Top