Excel get years from date column

Jonathan Brotto 1,076 Reputation points
2022-01-17T15:01:46.71+00:00

I am trying to select a column and next to it have the years show up. Copy this VBA code but not sure exactly if it will translate to VB.net

    Columns("C:C").Select
    Selection.NumberFormat = "m/d/yyyy"
    Range("C2").Select
    ActiveCell.FormulaR1C1 = "11/2/2020"
    Columns("D:D").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("D2").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=YEAR(RC[-1])"
    Columns("D:D").Select
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,580 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,532 questions
0 comments No comments
{count} votes