
Originally Posted by
:) Sixthsense :)
Unable to post code in the body of this post because of securi blocking.
I had the same last week, by editing out various lines of the code I was posting, I found that the block was caused by nesting multiple levels of Replace.
I got around it by using this method in my code.
variable = Replace(original string, what, with)
variable = Replace(variable, what, with)
Just had another idea, test post using your code to see if it works.
** Code below credited to
Sixthsense
(see post #5)
Function DataMatch(r As Variant) As String
Dim sText As String, sRes() As String, vMatch As Variant, v As Variant, x As Long, sPref
sText = r
sText = Replace(sText, "LOCATIONS /", "LOCATIONS/", , , vbTextCompare) & " "
sPref = "LOCATIONS/"
With CreateObject("vbscript.regexp")
.Pattern = sPref & "([a-z]*)/(\d{1,3})/([a-z]*( |;))"
.MultiLine = False
.Global = True
.IgnoreCase = True
If .test(sText) Then
Set vMatch = .Execute(sText)
For Each v In vMatch
x = x + 1
ReDim Preserve sRes(1 To x)
sRes(x) = Replace( _
Replace(v, sPref, "", , , vbTextCompare), ";", "", , , vbTextCompare)
Next v
End If
End With
DataMatch = Join(sRes, ",")
End Function
Bookmarks