|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Sub TEST6()
Dim ar, br, i&, j&, strKey$, dic As Object
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
With Sheets(1)
ar = Range(.[B4], .Cells(Rows.Count, "N").End(3))
For j = 2 To UBound(ar, 2)
For i = 2 To UBound(ar) Step 5
strKey = ar(1, j) & ar(i, j) & ar(i + 1, j)
dic(strKey) = ar(i + 3, j)
Next i
Next j
End With
ar = [B4].CurrentRegion
For i = 2 To UBound(ar)
If ar(i, 2) = "" Then ar(i, 2) = ar(i - 1, 2)
strKey = ar(i, 2) & ar(i, 3) & ar(i, 4)
ar(i, 5) = dic(strKey)
Next i
[B4].CurrentRegion = ar
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|