|
楼主 |
发表于 2020-5-12 15:11
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub lqxs()
Dim d, Arr, i&, Brr(1 To 500, 1 To 4), n%, Crr, j%
Set d = CreateObject("Scripting.Dictionary")
Sheet3.Activate
[a2:i5000].ClearContents
[g2:i5000].Font.ColorIndex = xlNone
Arr = Sheet.[a1].CurrentRegion
For i = 2 To UBound(Arr)
n = n + 1
Brr(n, 1) = Arr(i, 3): Brr(n, 2) = Arr(i, 22): Brr(n, 3) = Format(Arr(i, 23), "0.00"): Brr(n, 4) = Format(Arr(i, 24), "0.00")
d(Brr(n, 1) & "") = n + 1
Next
[a2].Resize(n, 4) = Brr
Crr = Sheet2.[a1].CurrentRegion
For i = 2 To UBound(Crr)
If d.exists(Crr(i, 2) & "") Then
n = d(Crr(i, 2) & "")
Cells(n, 7) = Crr(i, 18): Cells(n, 8) = Format(Crr(i, 19), "0.00"): Cells(n, 9) = Format(Crr(i, 21), "0.00")
For j = 7 To 9
If Cells(n, j - 5).Value <> Cells(n, j).Value Then Cells(n, j).Fornt.ColorIndex = 3
Next
End If
Next
End Sub |
|