Home / User Contributed Macros / Find and Replace

Find and Replace


The following macro code used for find and replace value in the selected range.
Sub FindAndReplace()
Dim txt as String,replaceAs as String
txt = "Arun"
replaceAs = "destText"
for i = 1 to Selection.rows.count
for j = 1 to Selection.columns.count
Selection.cells(i, j).value = replace (Selection.cells(i, j).value, txt , replaceAs)
next j
next i
End Sub

    Sasikumar Annamalai  18 Jul 2008 
    This macro cannot be applicable for format related replacement.
    For example Currency format changes, '$' symbol was replaced by 'USD'.
    It was possible by using " Selection.cells(i, j).Text " tag.



     RSS of this page