WeekNum Trouble
Thanks!
"Dave Peterson" wrote:
Use DateSerial instead of date().
Use Date instead of Today()
Both =date() and =today() are worksheet functions.
Brad wrote:
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?
--
Dave Peterson
|