+ Reply to Thread
Results 1 to 5 of 5

Change code so macro activates when entry date is older or equal to current date

  1. #1
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    244

    Change code so macro activates when entry date is older or equal to current date

    Thank you for taking a look at my issue.

    A very kind Forum Guru named xladept helped me develop the following code that works beautifully:
    Please Login or Register  to view this content.
    Unfortunately, I have discovered a small, but serious, design flaw in this code. If the person in our office responsible for the Excel data entry is out sick, the spreadsheet is not opened that day or days, so the formulas that the code 'freezes' stay as formulas. As a result, when that person comes back into the office and opens the Excel file, the code will activate, but only for whatever day is current. All the days missed are left behind with intact formulas which creates a problem down the road.

    I need to change the code from a logic of "if D equals current date, then activate" to "if D is older or equals current date, then activate". This way when the data entry person comes back in the office and opens the Excel file, the macro will 'freeze' all the effected formulas that were missed.

    Hopefully I've described the issue satisfactorily.

    Thank you ahead of time for any assistance.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Change code so macro activates when entry date is older or equal to current date

    Hi Big.Moe,

    Try this:

    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change code so macro activates when entry date is older or equal to current date

    Hello Big Mac,

    It looks like you only need to change the logical operator from "=" to "<=" for the date, like this...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    244

    Re: Change code so macro activates when entry date is older or equal to current date

    Thanks guys.

    I kinda figured that changing the "=" to "<=" would do it, but since my code skills are very rudimentary, I figured I'd better check-in with the experts to make sure.

    I'll make the changes and see what happens in the morning.

    Thanks again for your help!

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Change code so macro activates when entry date is older or equal to current date

    The help you got is "the finest kind".
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ 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. [SOLVED] sum if defined date is less than or equal to current date
    By Kanuck in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-09-2016, 01:55 PM
  2. Replies: 0
    Last Post: 11-23-2015, 04:50 AM
  3. MACRO for finding dates which are less than or equal to current date,
    By drsantosh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2011, 06:49 AM
  4. Replies: 4
    Last Post: 09-01-2011, 03:25 PM
  5. Macro to change date format and then run function based on greater than or equal to
    By Libster78 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2010, 09:37 AM
  6. I want any date 90 days or older from current date change color
    By Big Abalone in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-23-2006, 12:10 AM
  7. Deleting rows older than current date and inserting a new row
    By Dan E. in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2005, 11:20 AM

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