Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
WeekNum Trouble
I've wrote a function to take an integer representing the Calendar Week and
return the date of the monday of that week. A reverse of the weeknum function. Works fine when I paste the formula in a worksheet, but I get a compile error in vba. Here's the code. Function GetDate(iCalWeek As Integer) As Date ' ' Takes calendar week num as an argument and returns the date of monday of that week ' Dim sSunday As Date sSunday = Date(Year(Today()), 1, 1) + _ (7 - Weekday(Date(Year(Today()), 1, 1)) - 6) + (iCalWeek * 7) GetDate = sSunday + 1 End Function any ideas? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
weeknum | Excel Discussion (Misc queries) | |||
=WEEKNUM | Excel Programming | |||
Weeknum help | Excel Worksheet Functions | |||
WEEKNUM() | Excel Discussion (Misc queries) | |||
WeekNum Trouble | Excel Programming |