|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
arr = ActiveSheet.UsedRange
For j = 2 To UBound(arr)
If Len(arr(j, 1)) = 0 Then Exit For
If Not d.exists(arr(j, 1)) Then
Set d(arr(j, 1)) = CreateObject("scripting.dictionary")
End If
d(arr(j, 1))(j) = ""
Next j
For j = 2 To UBound(arr)
If d.exists(arr(j, 3)) Then
If d(arr(j, 3)).Count > 0 Then
k = d(arr(j, 3)).keys()(0)
arr(k, 2) = arr(j, 4)
arr(j, 5) = "已到货"
d(arr(j, 3)).Remove k
End If
End If
Next j
ActiveSheet.UsedRange = arr
End Sub
|
|