Hi
Maybe ............
Have a look at this to see if it helps. This example seems to deal with the task you are asking about.
I have not shown the changing of the FirstDayOfWeek, but if needed then it is trivial to test those variables out too.
The example uses a DataGridView named 'dgv' as shown below. I have set some test dates surrounding a leap year, but they can be editted to suit for testing.
'https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.dateandtime.datepart?view=netframework-4.7.2&f1url=%3FappId%3DDev16IDEF1%26l%3DEN-US%26k%3Dk(Microsoft.VisualBasic.DateAndTime.DatePart);k(TargetFrameworkMoniker-.NETFramework,Version%253Dv4.7.2);k(DevLang-VB)%26rd%3Dtrue
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With dgv
.Rows.Add("01 Jan 2023")
.Rows.Add("31 Dec 2023")
.Rows.Add("01 Jan 2024")
.Rows.Add("31 Dec 2024")
.Rows.Add("01 Jan 2025")
.Rows.Add("31 Dec 2025")
End With
Calc()
End Sub
Private Sub DataGridView1_CellValidated(sender As Object, e As DataGridViewCellEventArgs) Handles dgv.CellValidated
If e.ColumnIndex = 0 Then Calc()
End Sub
Sub Calc()
For i As Integer = 0 To dgv.RowCount - 1
If Not i = dgv.NewRowIndex Then
dgv(1, i).Value = DatePart(DateInterval.WeekOfYear, CDate(dgv(0, i).Value), FirstDayOfWeek.Monday, FirstWeekOfYear.Jan1)
dgv(2, i).Value = DatePart(DateInterval.WeekOfYear, CDate(dgv(0, i).Value), FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFullWeek)
dgv(3, i).Value = DatePart(DateInterval.WeekOfYear, CDate(dgv(0, i).Value), FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays)
End If
Next
End Sub
End Class