View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default macro to replace

--Use Find/Replace dialog to replace 2010 with 2009

--OR use a formula in cell B1 and copy down
=DATE(2009,MONTH(A1),DAY(A1))

--OR if you are looking for a macro then try

Sub Macro()
Dim cell As Range
For Each cell In Selection
cell.Value = DateAdd("yyyy", -1, cell)
Next
End Sub

--
Jacob


"puiuluipui" wrote:

Hi, in column "A" i have dates. (01.12.2010 ; 02.12.2010 ; 03.12.2010....) I
need to replace only the year.

01.12.2010 01.12.2009
02.12.2010 02.12.2009
03.12.2010 02.12.2009
......

Can a macro replace only the year?
Thanks!