Function prem(an As Integer) As Date
For n = CDate("01/01/" & an) To CDate("07/01/" & an)
If Weekday(n) = 5 Then prem = n - 3
Next n
End Function
Function NOSEM(ladate As Date) As Variant
NOSEM = Int((ladate - prem(Year(ladate))) / 7) + 1
If NOSEM = 53 And Weekday(ladate) < 5 Then NOSEM = "1 de " & Year(ladate) + 1
End Function