Hi
I am trying to modify a cell formula with the Replace function.
I can't see what I am doing wrong. Anyone help?
I am trying to modify a cell formula with the Replace function.
I can't see what I am doing wrong. Anyone help?
Code:
The Formula in the target cell =
='C:\Documents and Settings\Holiday macro\[Holiday2011.xls]Year 2011'!C5
I am using the below code but it returns just the end portion ='Year 2012'!C5
where I expect just the year to change
='C:\Documents and Settings\Holiday macro\[Holiday2012.xls]Year 2012'!C5
Where last year = 2011
Yr=2012
Range("C3").Formula = Replace(Range("C3").Formula, LastYr, Yr)