Change formula to Indirect

R

Ronbo

I need to change a lot of formulas to "Indirect".

Example, A1, =B1 - Need to change it to =Indirect("B1")

I have been trying find and replace;

Find =, Replace XIndirect("
This produces XIndirect("B1

How can I Find the end of formula and add, ")

Any ideas on how to add to the end of the formula or any other way of
changing a formula to indirect would be appreciated.
 
I

Ian

Sub change_formula()
For c = 1 To 5
For r = 1 To 10
Cells(r, c).Formula = "=indirect(""" & Right(Cells(r, c).Formula,
Len(Cells(r, c).Formula) - 1) & """)"
Next r
Next c
End Sub
 
R

Ronbo

Ian -

Thanks a lot, that is exactly what I need. However, I am getting a syntax in

Cells(r, c).Formula = "=indirect(""" & Right(Cells(r, c).Formula,
Len(Cells(r, c).Formula) - 1) & """)"

which I copied and pasted. Any ideas?
 
Top