#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code help.

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Code help.

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

Richard Choate

"Ken" wrote in message
...
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!


  #3   Report Post  
Posted to microsoft.public.excel.programming
acw acw is offline
external usenet poster
 
Posts: 19
Default Code help.

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
-----Original Message-----
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!
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"