bleep-blop
Registered User.
- Local time
- Today, 12:22
- Joined
- Sep 30, 2013
- Messages
- 24
If the last sunday of the year is the 25th of December then that is week 53, if the last sunday is greater after the 25th then that sunday starts week 1 of the next year.
Still testing, but this one is looking better
Code:
Private Sub Command2_Click()
Dim Test As Date
Test = Text0
checker = Test - Weekday(Test) + 1 'finds the previous sunday
MsgBox checker
checker2 = Format(checker, "dd") 'gets the value of the date of that sunday
MsgBox checker2
If Month(checker) = 12 And checker2 = 25 Then 'checks if the sunday is the 25th of december
YearNum = Year(Test) 'corrects accordingly
WeekNum = 53
Answer = WeekNum & "-" & YearNum
MsgBox Answer
Else 'else it uses the getweeknum function
MsgBox getWeekNum(Test)
'MsgBox getWeekNum([Test])
End If
End Sub
Still testing, but this one is looking better