Hello
I adapted some code from a previous posting of mine to also look at the date column and fill in the year column.
http://www.mrexcel.com/forum/showthread.php?t=552135
Credit goes to HOTPEPPER who helped me set up the Month part of this script.
However, for my data purposes I need the 2 digit year. Eg 11 instead of 2011. Any ideas how I might achieve this?
I put the code below~
I adapted some code from a previous posting of mine to also look at the date column and fill in the year column.
http://www.mrexcel.com/forum/showthread.php?t=552135
Credit goes to HOTPEPPER who helped me set up the Month part of this script.
However, for my data purposes I need the 2 digit year. Eg 11 instead of 2011. Any ideas how I might achieve this?
I put the code below~
Code:
Dim tc As Range, yc As Range, y As Long
Set tc = Range("1:1").Find("Date", , , xlWhole)
If tc Is Nothing Then MsgBox "Date Column not Found", vbExclamation: Exit Sub
Set yc = Range("1:1").Find("Year", , , xlWhole)
If tc Is Nothing Then MsgBox "Year Column not Found", vbExclamation: Exit Sub
y = Cells(Rows.Count, tc.Column).End(xlUp).Row
With yc.Offset(1).Resize(y - 1)
.Formula = "=YEAR(" & tc.Range("A2").Address(0, 0) & ")"
.Value = .Value
End With