So i want to be able to turn on/off the days via checkboxes.
I found this code... which will basically count the days that aren't saturday or sunday, but Can someone modify this code so that the days are only counted if the checkboxes are selected....
Checkboxes are called: ChkSunday, ChkMonday, ChkTuesday, ChkWednesday, ChkThursday, ChkFriday, ChkSaturday.
Expand|Select|Wrap|Line Numbers
- Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
- On Error GoTo Err_WorkingDays
- Dim intCount As Integer
- intCount = 0
- Do While StartDate <= EndDate
- Select Case Weekday(StartDate)
- Case Is = 1, 7
- intCount = intCount
- Case Is = 2, 3, 4, 5, 6
- intCount = intCount + 1
- End Select
- StartDate = StartDate + 1
- Loop
- WorkingDays = intCount
- Exit_WorkingDays:
- Exit Function
- Err_WorkingDays:
- Select Case Err
- Case Else
- MsgBox Err.Description
- Resume Exit_WorkingDays
- End Select
- End Function
Pleeeeeeeeeeeeaaaaaaaaaseeeeeeeeee help :) Cheers.