# Thread: Find the no.of working days between two gn. dates

1. ## Find the no.of working days between two gn. dates

Hi All,

I have a requirement, where i have to consider business days only (no weekends). This is something similar to the NetworkDays function in EXCEL. So inorder to do that I need to find the no. of working days between two given dates and loop it so many no. of times to run the EOD.

Can any one pls tell me how to do it in VBA.

Thanks
Kishore

2. ## Re: Find the no.of working days between two gn. dates

Use Google. Type in 'VBA find number work days'

Alternatively, you can try something like this...

Lookup the VBA function DateDiff and DatePart.

Using DateDiff, you can figure out the number of days between your 2 dates. Then use DatePart to get the weekday of the first day and the last day, and do some logic to figure out the number of weekends in between those dates. This won't work with holidays though.

Aracknid

3. ## Re: Find the no.of working days between two gn. dates

Hi Aracknid,

I have tried using this method given below.

Cur_Date = "6/28/10"

For Week_Day_Cnt = 1 To 20
Weekday_Name = WeekdayName(weekday_test)
If weekday_test &gt;= 2 And weekday_test &lt;= 6 Then 'To check the weekday between monday to friday.
Total_working_days = Total_working_days + 1
End If
Next

Thanks for the solution any way.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.