Forum Discussion
175429
Oct 17, 2025Copper Contributor
Multi-replace Macro
Hey all,
I need some assistance creating a macro that replaces multiple phrases.
Below are the phrases I have and the phrases I want them changed to without having to manually use "Find and Replace" each time.
"ROr ROY" replaced with "LK Fin"
"OKP and DON" replaced with "HU Dep"
"Signs (Single)" replaced with "PE Dep"
When I look elsewhere, I'm shown how to replace words but not phrases.
Any assistance would be greatly appreciated.
1 Reply
How about this:
Sub MultiReplace() Dim replacements As Variant Dim i As Integer ' Define your phrases and replacements replacements = Array( _ Array("ROr ROY", "LK Fin"), _ Array("OKP and DON", "HU Dep"), _ Array("Signs (Single)", "PE Dep") _ ) ' Loop through each pair and replace For i = LBound(replacements) To UBound(replacements) With ActiveDocument.Content.Find .Text = replacements(i)(0) .Replacement.Text = replacements(i)(1) .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .Execute Replace:=wdReplaceAll End With Next i End Sub