LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
weeknum reno Excel Discussion (Misc queries) 2 May 15th 08 11:56 PM
=WEEKNUM TheRook Excel Programming 1 August 25th 06 08:53 AM
Weeknum help SoSoExcelGuy Excel Worksheet Functions 2 August 1st 06 03:14 PM
WEEKNUM() Ciara Excel Discussion (Misc queries) 5 April 13th 05 12:09 PM
WeekNum Trouble WillRn Excel Programming 3 November 9th 04 04:14 PM


All times are GMT +1. The time now is 01:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"