Here,try this code on a SAMPLE data:I'm trying to figure out a vba code to take the contents of cell "B1" and replace it in a formula in cell "C1" and then loop to the end of the data set. Can someone help me out with this? Thanks
Sub Find_Replace()
For Each Cell In Range("B1:B" & Cells(Rows.Count, 2).End(xlUp).Row)
Cell.Value = Cell.Offset(0, 1).Formula
Next
End Sub
I don't know what do you want??
Be more specific Plz
ZAX
Ha,Now I understand,here's a code that will help you:I have a formula in cell c1 that that has a part in quotes - I'm looking for a vba code that will take the contents in B1 and put it in the formula between the quotes. I can do find and replace one by one, but I have to do it over 50 times, so I'm trying to figure out a macro that would take B1 and put it in the formula in C1, then B2 into C2 and so on until the end of the data set.
Hopefully that makes more sense.
Thanks again
Sub Find_Replace()
For Each Cell In Range("C1:C" & Cells(Rows.Count, 3).End(xlUp).Row)
Cell.Formula = Left(Cell.Formula, InStr(1, Cell.Formula, """")) & Cell.Offset(0, -1).Value & Right(Cell.Formula, Len(Cell.Formula) - InStr(1, Cell.Formula, """"))
Next
End Sub