+ Reply to Thread
Results 1 to 5 of 5

(SOLVED) Calculate days between two dates and enter nr of days in another textbox

  1. #1
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    110

    (SOLVED) Calculate days between two dates and enter nr of days in another textbox

    Good afternoon

    Once again im grateful for everyone participating in this forum. you are all the best and thanks for always helping.

    i have a textbox already configured to show the system date. so everyday when u open the date will change.

    we always get certain documents where there is a date stamp and then u have to manually calculate 90 days from there.

    if it is 90 days and more then the clearance paper expired, then u must apply for a new one.

    so i want when i open the userform, enter the date on the "clearance" it must tell me how many days have lapsed and if more than 90 days from that date

    show "Expired" on a label i created.

    i attaching the file where i already put some vba codes

    i managed to have the days calculated.

    however if the days you enter the date and it must be a date before todays date, then only when the days reach 90 and more it must show "Expired" in the label

    i already created the label. i just need help with the coding
    Attached Files Attached Files
    Last edited by Stona; 02-28-2020 at 06:05 AM. Reason: Problem was solved

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Calculate days between two dates and enter nr of days in another textbox

    Your Code had only one error

    you said < 90 when you meant > 90

    Please Login or Register  to view this content.
    However. You used After_Update to update Result and the Label. Is that not unwieldy?

    Try this instead:

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    110

    Re: Calculate days between two dates and enter nr of days in another textbox

    Thank you mehmetcik

    i adjusted as you pointed out and the reason why i used "afterupdate" is because im still learning vba.

    it now calculates the days as i type in the date,

    However

    if you type in 01/01/2020 it shows 57 days and "expired" in label3.

    i only want it to show "Expired" when the days shows 91 and more.

    can you help again please?

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Calculate days between two dates and enter nr of days in another textbox

    Hi.

    I have made a few changes for you.

    1. You are hiding your label if the date is not expired.
    So you should format it and insert the caption at design time
    They never need to change.

    2. I have changed your code to:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    01-23-2020
    Location
    Namibia
    MS-Off Ver
    2016
    Posts
    110

    Re: Calculate days between two dates and enter nr of days in another textbox

    Thank you very much I am satisfied now.

    I am grateful for this forum and everyone contributing to make us look like experts.

    In our working environment we have a few documents of which needs to be calculated. This "simple" calculator will definitely do a tremendous work.

    Once again thank you.


    Stoney
    Namibia

+ 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] Formula to calculate working days and calendar days per month-year ?
    By donny007 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-05-2018, 06:23 PM
  2. Replies: 7
    Last Post: 12-27-2017, 09:57 AM
  3. Calculate days excluding some days between dates
    By sam16 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-06-2017, 02:35 PM
  4. [SOLVED] calculate total number of days between two days based on 365 days year
    By aparunkumar in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-14-2016, 12:51 AM
  5. Replies: 0
    Last Post: 06-11-2015, 03:12 AM
  6. Calculate total working days and excepted leave days
    By megaiooo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-21-2013, 09:29 AM
  7. Replies: 2
    Last Post: 09-15-2010, 09:28 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