Just in case someone wonders why I don't use the DatePart function for week numbers, I noticed that it gives incorrect results.
Code:Option Explicit Private Sub Form_Load() Dim intYear As Integer For intYear = 2000 To 2010 Debug.Print DateSerial(intYear, 13, 0), IWeek(DateSerial(intYear, 13, 0)), DatePart("WW", DateSerial(intYear, 13, 0), vbMonday, vbFirstFourDays) Next End SubSo that is why I had to write a "cumbersome" week numbering math. But as far as I can see it works correctlyCode:31.12.2000 2000-W52-7 52 31.12.2001 2002-W01-1 1 31.12.2002 2003-W01-2 1 31.12.2003 2004-W01-3 1 31.12.2004 2004-W53-5 53 31.12.2005 2005-W52-6 52 31.12.2006 2006-W52-7 52 31.12.2007 2008-W01-1 53 31.12.2008 2009-W01-3 1 31.12.2009 2009-W53-4 53 31.12.2010 2010-W52-5 52![]()




Reply With Quote