|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub abtoab2() '带改进 运行太慢了
Range("ab4:ab50000").Delete
T1 = Timer
k = Sheet2.Range("a65536").End(xlUp).Row: L = Sheet1.Range("aa65536").End(xlUp).Row
kkk = Range("aa65536").End(xlUp).Row
ReDim Brr(1 To kkk): Dim ii As Integer, kc As Integer, f As Integer, m As Integer
Set d = CreateObject("Scripting.Dictionary")
arr库存 = Sheet2.Range("a2:i" & k)
For kc = 1 To k - 1
If arr库存(kc, 1) <> "" And arr库存(kc, 9) > 0 Then
If arr库存(kc, 8) Like "*" & "委外仓" & "*" = True Then
d(arr库存(kc, 1)) = d(arr库存(kc, 1)) + arr库存(kc, 9) * 0.9
Else
d(arr库存(kc, 1)) = d(arr库存(kc, 1)) + arr库存(kc, 9)
End If
End If
Next
'-------------------
With Sheet1
.Range(.Cells(3, 27), .Cells(d.Count + 3 - 1, 27)) = WorksheetFunction.Transpose(d.keys)
.Range(.Cells(3, 28), .Cells(d.Count + 3 - 1, 28)) = WorksheetFunction.Transpose(d.items)
End With
Set d = Nothing
T2 = Timer: MsgBox T2 - T1
End Sub |
|