Finding out no of working days without having to use Networkdays (in Excel)
Finding out no of working days without having to use Networkdays (in Excel)
Rate Finding out no of working days without having to use Networkdays (in Excel)
(1(1 Vote))
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
Finding out no of working days without having to use Networkdays (in Excel) Comments
No comments yet — be the first to post one!
Post a Comment