Help needed to writing a macro to put the year in column B of a table using Table nomenclature & the Evaluate method
Hi Bob,
Am Fri, 26 Dec 2014 19:14:07 +0100 schrieb Claus Busch:
or try Solution5:
if you want the year with 2 digits try:
Sub Solution5()
Dim LRow As Long, i As Long
Dim varTmp As Variant, varOut() As Variant
LRow = Cells(Rows.Count, 1).End(xlUp).Row
varTmp = Range("A2:A" & LRow)
ReDim Preserve varOut(UBound(varTmp) - 1, 0)
For i = LBound(varTmp) To UBound(varTmp)
varOut(i - 1, 0) = Year(varTmp(i, 1)) Mod 1000
Next
Range("B2").Resize(UBound(varTmp)) = varOut
End Sub
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
|