+ Reply to Thread
Results 1 to 8 of 8

Having trouble with "=Today()" formula in macro

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Having trouble with "=Today()" formula in macro

    I have a macro that I run several times during the day. The very first time I run it in the morning I want it to clear the sheet. I figured this would be the solution but the clear fires every time, even when the date says yesterday.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Having trouble with "=Today()" formula in macro

    Please Login or Register  to view this content.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Having trouble with "=Today()" formula in macro

    Try:

    Please Login or Register  to view this content.

    Edit: just seen Norie's post and he is, of course, correct in using VBA's "Date" rather than "Today". Or, you could use Int(Now) ... just trying to make up for lost ground


    Regards, TMS
    Last edited by TMS; 10-02-2013 at 01:09 PM.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Having trouble with "=Today()" formula in macro

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Having trouble with "=Today()" formula in macro

    Awesome! I have a few things to try next time I run this macro. Thanks.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Having trouble with "=Today()" formula in macro

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  7. #7
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Having trouble with "=Today()" formula in macro

    I ended up using Date instead of Today. Works great. Thanks

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Having trouble with "=Today()" formula in macro

    Best choice

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. condit. format: If date in cell = today, display "Today"
    By ratkins in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2013, 01:33 PM
  2. Help adding VBA code to existing macro to select "today's" date
    By kennected in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2012, 09:21 PM
  3. Replies: 3
    Last Post: 08-28-2010, 09:31 AM
  4. Macro to File/Save as "Numbers as of [today's date]" on desktop
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-26-2009, 11:38 AM
  5. Macro to rename a worksheet to "Numbers as of [+today's date]"
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2009, 03:28 PM

Tags for this Thread

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