Originally Posted by
firefytr
Is it always replaced with the value in A1? If so, no loop is needed...
[vba] wRange("B:B").Replace "~~", Cells(1, 1).Value[/vba]
Of course if you wanted to qualify your sheet/book, you would add them in..
[vba] Dim wb As Workbook, ws As Worksheet
Set wb = ActiveWorkbook
Set ws = wb.ActiveSheet
ws.Range("B:B").Replace "~~", ws.Cells(1, 1).Value[/vba]
Of course if I did read it wrong and you have a specific entry for each value in their respective rows, you might, depending on your specifics, find it is faster to do it all at once...
[vba]Sub FormulaReplace()
Dim wb As Workbook, ws As Worksheet
Set wb = ActiveWorkbook
Set ws = wb.ActiveSheet
Application.DisplayAlerts = False
Application.ScreenUpdating = False
ws.Columns(3).Insert 'will preserve formatting
With ws.Range("C2:C" & ws.Cells(ws.Rows.count, "B").End(xlUp).Row)
.Formula = "=SUBSTITUTE(B2,""~"",A2)"
.Value = .Value
End With
ws.Columns(2).Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub[/vba]
HTH