|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 vleexhya 于 2018-9-8 15:01 编辑
Sub A()
Dim arr, d, x, i&, j&, k&, myr&, myr_1&, p_n$, i_c1$, i_c2$, i_c3$, i_c4$, i_c11$, i_c21$, i_c31$, i_c41$
Sheets("2018").Select
Range("A1").Select
Set d = CreateObject("scripting.dictionary")
arr = [A1].CurrentRegion
myr = [c65536].End(xlUp).Row
i = 1
While i > myr
If arr(i, 2) <> "" Then
i_c1 = WorksheetFunction.Substitute(arr(i, 3), "*", "~*", 1)
i_c2 = WorksheetFunction.Substitute(arr(i, 4), "*", "~*", 1)
i_c3 = WorksheetFunction.Substitute(arr(i, 6), "*", "~*", 1)
i_c4 = WorksheetFunction.Substitute(arr(i, 7), "*", "~*", 1)
x = i_c1 & "|" & i_c2 & "|" & i_c3 & "|" & i_c4
d(x) = arr(i, 2)
i = i + 1
End If
Wend
For k = 2 To myr
i_c11 = WorksheetFunction.Substitute(arr(k, 3), "*", "~*", 1)
i_c21 = WorksheetFunction.Substitute(arr(k, 4), "*", "~*", 1)
i_c31 = WorksheetFunction.Substitute(arr(k, 6), "*", "~*", 1)
i_c41 = WorksheetFunction.Substitute(arr(k, 7), "*", "~*", 1)
x = i_c11 & "|" & i_c21 & "|" & i_c31 & "|" & i_c41
If d.exists(x) Then
Cells(k, 2) = d(x)
Else
End If
Next
End Sub
|
|