|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Sub TEST6()
Dim ar, i&, j&, r&, dic As Object, Rng As Range, strKey$
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
With Sheets("汇总表")
r = .Cells(Rows.Count, "E").End(xlUp).Row
Set Rng = .Range("e10:xfd" & r)
ar = Intersect(.UsedRange, Rng).Value
For i = 2 To UBound(ar)
For j = 2 To UBound(ar, 2)
strKey = ar(i, 1) & "|" & ar(1, j)
dic(strKey) = ar(i, j)
Next j
Next i
End With
r = Cells(Rows.Count, "E").End(xlUp).Row
Set Rng = Range("e10:xfd" & r)
With Intersect(ActiveSheet.UsedRange, Rng)
ar = .Value
For i = 2 To UBound(ar)
For j = 2 To UBound(ar, 2)
strKey = ar(i, 1) & "|" & ar(1, j)
ar(i, j) = dic(strKey)
If IsDate(ar(i, j)) Then ar(i, j) = "'" & ar(i, j)
Next j
Next i
.Value = ar
End With
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
|