What syntax do I use to add todays date in an excel macro

G

Guest

I'm using office 2003 and would like to add todays date to a specific cell
during the running of a macro.
What is the syntax to accomplish this?

(when I record a macro I can select the cell I want but I figure the date
component has to be typed into the macro manually, ie edit macro and add the
required syntax)
 
D

Dave Peterson

with activesheet.range("b99")
.value = date
.numberformat = "mm/dd/yyyy"
end with

There's also now and time:

.value = now 'includes both time & date
.value = time 'just the time
.value = date 'just the date
 

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