2 Replies - 961 Views - Last Post: 09 October 2012 - 11:50 PM Rate Topic: -----

#1 raelkun00  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 01-October 12

Count the number of days between two dates excluding Sun and Sat.

Posted 08 October 2012 - 07:40 PM

Private Sub Command1_Click()
Dim Date1 As Date
Dim Date2 As Date
Date1 = InputBox("Enter date1")
Date2 = InputBox("Enter date2")
Print DateDiff("d", Date1, Date2)


This code only count the number of days.
Is This A Good Question/Topic? 0
  • +

Replies To: Count the number of days between two dates excluding Sun and Sat.

#2 leixnt  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 30
  • Joined: 24-July 11

Re: Count the number of days between two dates excluding Sun and Sat.

Posted 08 October 2012 - 08:30 PM

use weekday() function & looping to count day from monday-friday

note:
weekday() to check what day is it.
return value (cmiiw)
1 Sunday
2 Monday
3 Tuesday
4 Wednesday
5 Thursday
6 Friday
7 Saturday
Was This Post Helpful? 0
  • +
  • -

#3 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Count the number of days between two dates excluding Sun and Sat.

Posted 09 October 2012 - 11:50 PM

Have a look at using the DateDiff function and use weekday as your interval.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1