View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eric_G Eric_G is offline
external usenet poster
 
Posts: 41
Default Replace cell formula with revised text as noted within a cell valu

I am attempting to replace the text contained in a cell formula with text
specified in the another cell.

For example, the formulae contained in Cells D & row referenced in cell
A700) which currently reads "Feb-08" and I wish to replace the portion of the
formula containing "Feb-08" with the text contained in Cell B & row
referenced by Cell
BXXX) where cell A700 contains a row number.

Here is my VBA code:

.Range("D" & .Range("A700") & ":AZ" & .Range("A700")).Select
Selection.Replace What:="Dec-08", Replacement:= .Range("B" &
..Range("A700"), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

In summary, where the value of Cell A700 is 650, I wish to replace the
values "Dec-08" in the formula of row 650 with the value contained in Cell
B650 (which currently reads "Mar-09".