Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to goto specific cell (todays date) crimekilla Excel Discussion (Misc queries) 4 May 11th 10 04:42 PM
Why todays date shows up as #### in excel doc. halfpint Excel Discussion (Misc queries) 2 March 14th 07 03:46 PM
Excel 2000 - find todays date Richard Excel Discussion (Misc queries) 2 July 11th 06 01:41 PM
In Excel, Get todays date in a cell tbw Excel Discussion (Misc queries) 2 October 6th 05 12:08 AM
how is the syntax to replace a date, recorded within a macro with a cell value ? thomipilot Excel Programming 1 September 30th 04 05:18 PM


All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"