Originally Posted by
DanzaNZ
I have now found that the data source is actually spread over multiple columns not just A.
Is that an issue?
Sub test()
Dim a, i As Long, ii As Long, myPtn As String, AL As Object
Set AL = CreateObject("System.Collections.ArrayList")
myPtn = Join(Application.Transpose(Sheets("sheet3").Cells(1) _
.CurrentRegion.Columns(1).Value), Chr(2))
a = Sheets("sheet1").UsedRange.Value
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "([\$\(\)\-\^\|\\\{\}\[\]\+\*\?\.])"
myPtn = Replace(.Replace(myPtn, "\$1"), Chr(2), "|")
.Pattern = myPtn
For i = 1 To UBound(a, 1)
For ii = 1 To UBound(a, 2)
If .test(a(i, ii)) Then
AL.Add .Execute(a(i, ii))(0)
End If
Next
Next
End With
If AL.Count Then Sheets("sheet2").Cells(1).Resize(AL.Count).Value = _
Application.Transpose(AL.ToArray)
End Sub
Bookmarks