Remove and Replace All Characters in Microsoft Excel using VBA

The following FindandReplace() funciton allows you to replace or remove specific text and characters you want in Microsoft Excel. Just copy...

The following FindandReplace() funciton allows you to replace or remove specific text and characters you want in Microsoft Excel. Just copy the code below on your VBA code class or module.

1
2
3
4
5
6
Sub FindandReplace(FindWhat as String, ReplaceWith as String)
 
        Cells.Replace What:=FindWhat, Replacement:=ReplaceWith, LookAt:=xlPart, SearchOrder:= _
        xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
 
End Subz

Put this in your Sub or Function.

To Replace several text with new text.
1
>FindandReplace "OldText", "NewText"

To remove several text just leave the second argument blank.
1
FindandReplace "OldText", ""

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

Home item

Popular Posts