|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Sub TEST1()
Dim ar(), i&, j&, strJoin$, t#
Application.ScreenUpdating = True
t = Timer
ar = Sheets(1).[A1].CurrentRegion.Value
With CreateObject("VBScript.RegExp")
.Global = True
For j = 1 To UBound(ar, 2)
For i = 2 To UBound(ar, 2)
If Len(ar(i, j)) Then strJoin = strJoin & "|" & ar(i, j)
Next i
Next j
.Pattern = Mid(strJoin, 2)
ar = Range("C2", Cells(Rows.Count, "C").End(xlUp)).Value
For i = 1 To UBound(ar)
If .test(ar(i, 1)) Then
ar(i, 1) = .Execute(ar(i, 1))(0).Value
Else
ar(i, 1) = Empty
End If
Next i
End With
[D2].Resize(UBound(ar)) = ar
Application.ScreenUpdating = True
MsgBox "执行完毕!_用时: " & Format(Timer - t, "0.00") & " 秒", 64
End Sub
|
|