Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Macro fro Ctl-Shft ":" (colon) 1

Status
Not open for further replies.

ohmbru2

Technical User
Jul 24, 2001
51
US
Anyone know how I can invoke the "Control, Shift, Colon" function that returns the current time?
 
Works for me. What happens for you and what version are you using? If you've got 2000, and it doesn't work, let me know. dreamboat@nni.com
Brainbench MVP for Microsoft Word
 
Um, control-shift-colon?

Works with my 97, 2000 and XP. What do you get?
 
My appologies, I should be more clear.

I'm trying to create a macro that will store the current time in the cell. I know the ctl-shift-: does that but I want to assign that to a macro. The function itself works fine, but I need to create a macro. I'm using Excel 97.


Thanks,

Brian
 
OK. I understand. Because its a sequence of keys, the macro recorder will not work (as you have already figured out I am sure). The only thing I can think of is using a tool that records key strokes. (check out
The other option is to write code to do this for you.
 
Why not just use code to insert the formula: "=NOW()" into the cell?

This will put the current Time and Date in the cell where it is written.

You can format the cell to display the information in what ever format you need.

Hope this helps
 
Hello, ohmbru2.

May not get exactly what you want. But, ctrl+shift+":" can be simulated exactly by:

Sub macro() 'or give it a better name

ActiveCell.Value = Time()
ActiveCell.NumberFormat = "h:mm AM/PM"

End Sub

To even more closely simulate it, you can assign a shortcut key which, however, must be of more restricted form of ctrl+<a letter>, say, for instance ctrl+&quot;t&quot;.

regards - tsuji

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top