Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Help..please!
I'm a rookie in terms of VB, but I'm despretely trying to make Access count the number of days between two dates and then subtract the weekends. Can anyone tell me what is wrong with the follwing code: Option Compare Database Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer On Error GoTo Err_WorkingDays Dim intCountA As Integer Dim intCountB As Integer If StartDate Is Empty Then intCountA = 0 Else intCountA = 0 Do While StartDate <= EndDate Select Case Weekday(StartDate) Case Is = 1, 7 intCountA = intCountA Case Is = 2, 3, 4, 5, 6 intCountA = intCountA + 1 End Select StartDate = StartDate + 1 Loop WorkingDays = intCountA Exit_WorkingDays: Exit Function Err_WorkingDays: Select Case Err Case Else MsgBox Err.Description Resume Exit_WorkingDays End Select End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linking to Visual Basic for Applications Help Files | Excel Discussion (Misc queries) | |||
Visual Basic and SP2 | Excel Discussion (Misc queries) | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Macro Calling Visual Basic References | Excel Discussion (Misc queries) | |||
Visual Basic Error Message | Excel Discussion (Misc queries) |