Newbie help question (date and time)

Z

Zilbandy

I want to add a couple of commands to a custom toolbar that I have
made. I want to add a button to insert the current date in the active
cell and another to insert the current time in the active cell. My
problem is I can't find ANY commands on any toolbar that does those
tasks. I know how to add existing commands to toolbars.

I am aware of the keyboard shortcuts to do those things <ctrl-;> and
<ctrl-shift-;> but I would like to be able to do it with the mouse, as
well. If what I want requires macros, I may need some detailed
instructions on making the macros and getting them on my custom
toolbar.

I tried recording a couple of macros using the keyboard shortcuts, but
they would always insert into the original cell I used when recording
the macro. Also, I couldn't find a way to assign my macros, useless as
they are, to a toolbar.

Thanks.
 
P

Paul B

Zilbandy, try this

Sub ActiveCellDate()
ActiveCell = Format((Date), "m/dd/yyyy")
End Sub

Sub ActiveCellTime()
ActiveCell = Format((Time), "h:mm AM/PM")
End Sub

Right click on your toolbar, select macros, drag a button to it and assign
the macro to it


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
Z

Zilbandy

Zilbandy, try this

Sub ActiveCellDate()
ActiveCell = Format((Date), "m/dd/yyyy")
End Sub

Sub ActiveCellTime()
ActiveCell = Format((Time), "h:mm AM/PM")
End Sub

Right click on your toolbar, select macros, drag a button to it and assign
the macro to it

Ok, I got it done. It took me a while and a quicky search on Google to
find out about my hidden personal workbook, but I have my macros on my
custom tool bar. Thanks. :) I also found the 'Relative' button on the
record macro tool bar. That'll help me make macros. Macros... I need
macros... more macros! :)
 

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