ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Default Date: Today (https://www.excelbanter.com/excel-programming/272201-default-date-today.html)

Cathy Myers

Default Date: Today
 
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.

Chip Pearson

Default Date: Today
 
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

"Cathy Myers" wrote in message
...
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.




Abdul Salam

Default Date: Today
 
Hi,

to get todays date

= TODAY()
7 days before today
=TODAY()-7

Abdul Salam



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


Tritan

Default Date: Today
 
range("A1").Value = date
range("A2").Value = date - 7

Tritan

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


Cathy Myers

Default Date: Today
 
Hi Chip,

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

Yours,
C.M.

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

"Cathy Myers" wrote in message
...
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.



.


Cathy Myers

Default Date: Today
 
Thanks

C.M.

-----Original Message-----
Hi,

to get todays date

= TODAY()
7 days before today
=TODAY()-7

Abdul Salam



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

.


Cathy Myers

Default Date: Today
 
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.


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

"Cathy Myers" wrote in message
...
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.



.



All times are GMT +1. The time now is 05:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com