![]() |
#1
|
|||
|
|||
![]() Hello members, I am using the code below posted below to find and replace within range that I have assigned to selection.range but the problem here is it not only replacing within range but beyond the range. Code:
Sub nnewreplace() Dim e(), f() e = Array(" ", " ", Chr(160), Chr(9), "\(([a-z]{1,})\)") f = Array("", "", "", "", "\1.") Dim i As Integer Dim rng As Range Set rng = Selection.Range For i = LBound(e) To UBound(e) With rng.find .ClearFormatting .MatchWildcards = True .Text = e(i) .Replacement.Text = f(i) .Wrap = wdFindStop End With rng.find.Execute Replace:=wdReplaceAll Next End Sub Last edited by Bikram; 04-22-2022 at 04:24 AM. Reason: Added additional details |
|