+ Reply to Thread
Results 1 to 4 of 4

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

  1. #1
    Skeatt
    Guest

    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. #2
    gocush
    Guest

    RE: 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. #3
    Norman Jones
    Guest

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

    Skeatt,

    Try:

    Range("A1").Value = Date


    ---
    Regards,
    Norman



    "Skeatt" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #4
    Dave Peterson
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1