In Excel it is called Transpose, if you search for I guess you can find a way to filter column and collect just Years for Transpose.
In VB, if you are creating a worksheet by code, given a list of dates you can use Linq to get a distinct list of years, then use such list to fill cells one by one
Dim myDatesList As New List(Of DateTime) From {"01/01/2023", "03/04/2017", "01/07/2017", "7/17/2018", "01/02/2019", "05/27/2019", "06/23/2020", "2/27/2021", "04/25/2021", "01/01/2022"}
Dim myYearsSummary As List(Of Integer) = (From p In myDatesList Order By p Select p.Year).Distinct.ToList