+ Reply to Thread
Results 1 to 6 of 6

Automated Leave Tracker

  1. #1
    Registered User
    Join Date
    11-08-2022
    Location
    singapore
    MS-Off Ver
    365
    Posts
    12

    Automated Leave Tracker

    Hi I am formulating an automated leave tracker.I have userform that has start date and end date . Both are using date picker fields.How can I calculate the days applied for leave between these two days excluding leaves and specified holidays. Below are my codes. I have a combox3 - which basically states am/pm to state 0.5 days in my textfield(TextBox5) for the application of half day. I don't know how to write code for that as well. I am still a novice in VBA programming. I really appreciate your help in this.
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 11-08-2022 at 09:40 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,662

    Re: Automated Leave Tracker

    You can use WorksheetFunction.NetWorkDays to calculate elapsed days excluding weekends and holidays. But you will have to build a list of the holidays. Do you already have that?

    Please Login or Register  to view this content.
    where holidaylist is a range reference to your list of holiday dates.

    For a more comprehensive answer attach your actual Excel file. See yellow banner at the top of the page.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-08-2022
    Location
    singapore
    MS-Off Ver
    365
    Posts
    12

    Re: Automated Leave Tracker

    Omg! You solved it! I did look up the range of cells that refer to the dates of holidays as somehow it doesn't work when i am referencing to my excel table,"Holiday".
    Holiday - refers to the name of my table and Korea is the heading for the holidays. What is wrong with my code below and why it is not picking up the holidays from my table.
    However for now , I have explicitly indicated the range of cells and it works. But, I want it to be dynamic.

    Below code not working

    X= Application.WorksheetFunction.Networkdays(DTPicker1.Value,DTPicker2.Value,"Holiday[[Korea]]")

    Therefore, changed it to the below code.It works when I reference the range.
    X = Application.WorksheetFunction.NetworkDays_Intl(DTPicker1.Value, DTPicker2.Value, 1, Sheets("Database").Range("N2:N19"))

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,662

    Re: Automated Leave Tracker

    Maybe this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-08-2022
    Location
    singapore
    MS-Off Ver
    365
    Posts
    12

    Re: Automated Leave Tracker

    This is so helpful! It worked This forum is indeed so helpful.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,662

    Re: Automated Leave Tracker

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

+ 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. Replies: 2
    Last Post: 10-22-2018, 05:41 PM
  2. [SOLVED] Leave tracker - how to use formula to automate the total leave days
    By yiyi2 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-16-2018, 10:59 PM
  3. Leave Tracker
    By markusvirus in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-19-2017, 02:07 AM
  4. Help build a Leave tracker and Effort Time Estimation Tracker
    By cherias in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2015, 02:10 PM
  5. Automated Time Tracker
    By Tim Sugden in forum Excel General
    Replies: 1
    Last Post: 06-03-2011, 08:32 AM
  6. Leave Tracker
    By liarliar in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2008, 01:00 PM
  7. leave tracker
    By jprakash4u in forum Excel General
    Replies: 2
    Last Post: 03-25-2008, 12:32 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