ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What syntax do I use to add todays date in an excel macro (https://www.excelbanter.com/excel-programming/320476-what-syntax-do-i-use-add-todays-date-excel-macro.html)

Skeatt

What syntax do I use to add todays date in an excel macro
 
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)


gocush[_28_]

What syntax do I use to add todays date in an excel macro
 
Sub AddDate()
ActiveCell = Date
End Sub

"Skeatt" wrote:

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)


Norman Jones

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

Try:

Range("A1").Value = Date


---
Regards,
Norman



"Skeatt" wrote in message
...
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)




Dave Peterson[_5_]

What syntax do I use to add todays date in an excel macro
 
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



Skeatt wrote:

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)


--

Dave Peterson


All times are GMT +1. The time now is 12:26 AM.

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