Thursday, January 12, 2012

find and replace in batch in excel

Sub ReplaceText()
 'value to replace in D, value to be replaced by in E
For Each vCell In Range("d1:d49").Cells 'range to replace b
Columns("b:b").Cells.Replace What:=vCell, Replacement:=vCell.Offset(0, 1).Value, LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Next vCell
End Sub