|
表格比较复杂,数据不多
未经严格测试...
不知道有没有达到楼主要求
到货统计.zip
(25.27 KB, 下载次数: 32)
- Dim arrrk '入库数据_数组
- Sub 到货情况统计()
- Dim d As Object
- Dim arrmx '订单明细数据_数组
- Set d = CreateObject("Scripting.Dictionary")
- With ThisWorkbook.Worksheets("入库")
- arrrk = .Range("A1:I" & .Cells(65536, 2).End(3).Row)
- End With
- Call 删除重复数据 '删除入库数组中重复作业指令对应的数据
- For i = 3 To UBound(arrrk)
- If IsNumeric(arrrk(i, 2)) Then
- d(arrrk(i, 2)) = d(arrrk(i, 2)) + arrrk(i, 6)
- End If
- Next i
- With ThisWorkbook.Worksheets("订单明细")
- arrmx = .Range("A10:P" & .Cells(65536, 1).End(3).Row)
- For i = 1 To UBound(arrmx)
- If arrmx(i, 5) = d(arrmx(i, 2)) Then
- Cells(i + 9, "P") = "入"
- Else
- Cells(i + 9, "P") = d(arrmx(i, 2))
- End If
- Next i
- End With
- End Sub
- Sub 删除重复数据() '删除重复作业指令对应的数据
- Dim dz As Object '字典 作业指令
- Set dz = CreateObject("Scripting.Dictionary")
- For i = 3 To UBound(arrrk)
- If InStr(arrrk(i, 1), "作业指令") And (Not dz.exists(arrrk(i, 1))) Then
- dz(arrrk(i, 1)) = 1
- ElseIf InStr(arrrk(i, 1), "作业指令") And dz.exists(arrrk(i, 1)) Then
- Do
- For j = 1 To UBound(arrrk, 2)
- arrrk(i, j) = ""
- Next j
- i = i + 1
- If i - 1 = UBound(arrrk) Then Exit Do
- Loop Until InStr(arrrk(i, 1), "作业指令") 'Or i = UBound(arrrk) + 1
- End If
- Next i
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|