+ Reply to Thread
Results 1 to 7 of 7

Checking Date in Macro Code

  1. #1
    Registered User
    Join Date
    06-09-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2003
    Posts
    2

    Smile Checking Date in Macro Code

    I have a spreadsheet that I created that we use as our Invoice. I have created a macro button that does certain checks/balances when it is pressed, after the invoice has been created. One of the common problems was that the employees would forget to put a date on the invoice. So now, I have the code for that:
    Please Login or Register  to view this content.
    But now, I want to go one step further. In addition to checking to see if there is somthing in the field, I want it to check to make sure that the date entered is TODAY and if it's not, to popup with a MSGBOX that says, "Are you sure you want to enter a date other than today?". If they enter yes, the code proceeds with the checking. If they enter No, I want the program to stop running and to go to that field D5 and wait for the user to correct the date. As a newbie, I'm just unclear what function to use. I've tried various things, all to no avail. Can anyone help me? Thank you!
    Last edited by mmwtx; 06-09-2009 at 05:10 PM. Reason: Added Code Tags

  2. #2
    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: Help With Macros Needed

    Hello mmwtx,

    Welcome to the Forum!

    To make your posts easier to read, copy, and edit please wrap your code. I did it for you this time. Here is how you can do it next time.

    How to wrap your Code
    1. Select all your code using the mouse.
    2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.
    3. You can also do this manually by placing the tag [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end.

    As a member, You have agreed to follow the forum posting rules. Please take so time to familiarize yourself with the Do's and Don'ts here in the Forum, just click on the link below...

    Forum Rules
    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!)

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help With Macros Needed

    In addition, please amend your thread title.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-09-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Help With Macros Needed

    Thank you for adjusting my post as needed. I didn't realize I needed to do that. I'm happy to change my thread title; but can find no where that lists instructions on how to do that. Thanks for the help!
    Last edited by Paul; 06-09-2009 at 03:48 PM. Reason: Sent PM to user with instructions for editing thread title

  5. #5
    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: Help With Macros Needed

    Hello mmwtx,

    To change a Title on your post, click EDIT then Go Advanced and change your title.

  6. #6
    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: Help With Macros Needed

    Hello mmwtx,

    To change a Title on your post, click the EDIT button then the Go Advanced button and change your title.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Checking Date in Macro Code

    Try this; the user would enter dates as 060909 for example:

    Please Login or Register  to view this content.
    Hope this helps. J

+ 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