|
-
Aug 21st, 2000, 08:59 PM
#1
Thread Starter
Member
Hi there
Want to know how do I return a date of the nearest friday. At the minute if I enter a start date and number of weeks it returns a date exactly that number of weeks later. That is if I enter 23/08/2000 and then 1 week, i get 30/08/2000 back which is a wednesday(I think!!) what I want returned is fridays date 01/09/2000. How do I do this?
This is my function at the minute
Public Function CalcPeriodEnd(StartDate As Variant, NoWeeks As Variant) As Variant
On Error GoTo Proc_Err
Dim NewDate As Variant
CalcPeriodEnd = 0
NewDate = DateAdd("ww", NoWeeks, StartDate)
CalcPeriodEnd = Format$(NewDate, "dd/mm/yyyy")
'just to check output
'MsgBox Format$(NewDate, "dd/mm/yyyy"), vbOKOnly
Exit Function
Proc_Err:
ErrorHandler
End Function
Thanks in advance
Gin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|