by DazzlingGuy (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 5th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Finding out no of working days without having to use Networkdays (in Excel)
StDateValue = CDate(StDate.Text)
EndDateValue = CDate(EndDate.Text)
If (StDateValue >= EndDateValue) Then
MsgBox "Sorry Invalid Date Value", vbCritical, "VOID"
WorkingDays.Text = ""
Else
WorkingDays = DateDiffW(StDateValue, EndDateValue)
End If
End Sub
Function DateDiffW(StDateValue, EndDateValue)
For i = StDateValue To EndDateValue
If (WeekDay(i) <> 1) And (WeekDay(i) <> 7) Then
WorkingDaysValue = WorkingDaysValue + 1
End If
Next
DateDiffW = WorkingDaysValue
End Function
Private Sub UserForm_Activate()
StDate.Text = Now
EndDate.Text = Now + 10
End Sub
StDateValue = CDate(StDate.Text)
EndDateValue = CDate(EndDate.Text)
If (StDateValue >= EndDateValue) Then
MsgBox "Sorry Invalid Date Value", vbCritical, "VOID"
WorkingDays.Text = ""
Else
WorkingDays = DateDiffW(StDateValue, EndDateValue)
End If
End Sub
Function DateDiffW(StDateValue, EndDateValue)
For i = StDateValue To EndDateValue
If (WeekDay(i) <> 1) And (WeekDay(i) <> 7) Then
WorkingDaysValue = WorkingDaysValue + 1
End If
Next
DateDiffW = WorkingDaysValue
End Function
Private Sub UserForm_Activate()
StDate.Text = Now
EndDate.Text = Now + 10
End Sub
No comments have been posted about Finding out no of working days without having to use Networkdays (in Excel). Why not be the first to post a comment about Finding out no of working days without having to use Networkdays (in Excel).