![]() |
|
#1
|
|||
|
|||
|
Hi all members, I am working on a macro where i encountered an error Code:
Function newreplace(rng2) As Range
Dim e(), f()
e = Array("( ){2,}", "^s", Chr(160), "^t{2,}", "(\([a-z]\)){1,4}")
f = Array("\1", " ", " ", "^t", "\1")
Dim i As Integer
For i = LBound(e) To UBound(e)
With rng2.find
.ClearFormatting
.Replacement.ClearFormatting
.Text = e(i)
.Replacement.Text = f(i)
.MatchWildcards = True
.Wrap = wdFindStop
End With
rng2.find.Execute Replace:=wdReplaceAll
Next
End Function
|
|
#2
|
||||
|
||||
|
Code:
Function newreplace(rng2 As Range)
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Thank you, Paul. It worked!!
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trouble converting a sub to function, incl. passing argument and nixing Selection | Peterson | Word VBA | 6 | 08-19-2021 07:58 PM |
Using IF Function where logical test is for range of values
|
guciolino | Excel | 10 | 02-13-2017 08:05 AM |
passing variable from one sub to another
|
gbrew584 | Excel Programming | 10 | 03-21-2016 12:06 AM |
| Formula/function to return column names for matching values | GiJoe81 | Excel | 1 | 06-27-2015 12:13 AM |
MATCH function and time values
|
hanvyj | Excel | 2 | 05-29-2013 12:12 PM |