Default Date: Today

C

Cathy Myers

Hi,

I am very new to both Excel and VBA. How do I set a cell
to default to today's date, and another cell to default to
7 days before today?

Thanks,
C.M.
 
C

Chip Pearson

Cathy,

Use
=TODAY()
and
=TODAY()-7

If you want to use VBA, use

Range("A1").Value = Format(Now,"mm/dd/yyyy")
and
Range("A2").Value = Format(Now-7,"mm/dd/yyyy")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
C

Cathy Myers

Hi Chip,

Thank you. I will try it and let you know how it turns out.

Yours,
C.M.
 
C

Cathy Myers

Hey Chip,

Thank you so much! I inserted the code into my Auto_Open
sub routine, and it worked like a dream!

Yours,
C.M.
 

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