Need to Add 12 working Days...

I knew I had seen good functions for this on here (I have written a load of date-related functions these but they are in SQL server, so won't work in VBA) ;
 
I knew I had seen good functions for this on here (I have written a load of date-related functions these but they are in SQL server, so won't work in VBA) ;
yes i am so please just now need to have it check against the Bank Holiday Table next big challenge

ok so got this now working with this function code

Public Function addDays(ByVal iDays As Integer, ByVal dteStart As Date) As Date
Dim i As Integer
Dim m As Integer
m = Abs(iDays)
While m > 0
If iDays < 0 Then
dteStart = dteStart - 1
Else
dteStart = dteStart + 1
End If
If InStr(1, "sat/sun", Format$(dteStart, "ddd")) <> 0 Then
Else
m = m - 1
End If
Wend
addDays = dteStart
End Function


call by

=addDays(+12,Date())
 
Here is a sample database with a number of useful date functions.

 

Users who are viewing this thread

Back
Top Bottom