|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Sub TEST7()
Dim ar, br, vResult, i&, j&, r&, n&, t#
Application.ScreenUpdating = False
t = Timer
ar = Worksheets(1).[A1].CurrentRegion.Value
With Worksheets(2)
r = .Cells(.Rows.Count, "A").End(xlUp).Row
br = .Range("A1:A" & r)
End With
ReDim vResult(1 To UBound(ar) * 20, 1 To 3)
r = 0
With Worksheets(3)
.Cells.Clear
For i = 3 To UBound(ar)
r = r + 1
For j = 1 To 3
vResult(r, j) = ar(i, j)
Next j
n = 0
For j = 1 To UBound(br)
If InStr(br(j, 1), ar(i, 3)) Then
n = n + 1
If n > 1 Then
r = r + 1: vResult(r, 3) = br(j, 1)
End If
End If
Next j
.[A2].Resize(r, 3) = vResult
.Activate
Next i
End With
Application.ScreenUpdating = True
MsgBox "执行完毕!_用时: " & Format(Timer - t, "0.00") & " 秒", 64
End Sub
|
|