Эта функция будет искать каждую пятницу за последний месяц. Вы можете изменить ее в соответствии с другими днями, такими как понедельник "oldDay = 2" и т. Д. Метод будет работать с сегодняшней даты, но вы можете изменить это в соответствии с
Dim todaysDate As Date = Date.Today
Dim oldDay As Integer
Dim thisWeek As Date
Dim firstWeek As Date
Dim secondWeek As Date
Dim thirdWeek As Date
Dim fourthWeek As Date
''finds the Friday of the end of the current week
''No mattter what day you are working
Dim daycount As Integer
oldDay = Weekday(todaysDate)
thisWeek = todaysDate
If oldDay < 6 Then
daycount = 6 - oldDay
thisWeek = thisWeek.AddDays(+daycount)
ElseIf oldDay > 6 Then
daycount = oldDay - 6
thisWeek = thisWeek.AddDays(-daycount)
End If
firstWeek = thisWeek
secondWeek = thisWeek
thirdWeek = thisWeek
fourthWeek = thisWeek
fourthWeek = firstWeek.AddDays(-28)
thirdWeek = thirdWeek.AddDays(-21)
secondWeek = secondWeek.AddDays(-14)
firstWeek = firstWeek.AddDays(-7)