|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 订单进度检查()
- Dim d As Object, arr, i&, s$
- Set d = CreateObject("Scripting.Dictionary")
- Rem 提取当日出货量
- arr = Sheet2.Range("A1").CurrentRegion
- For i = 2 To UBound(arr)
- d(arr(i, 1)) = arr(i, 2)
- Next
- Rem 计算客户订单满足量
- arr = Sheet1.Range("A2:E" & Sheet1.Range("A1").CurrentRegion.Rows.Count)
- For i = 1 To UBound(arr)
- If d.Exists(arr(i, 2)) Then
- If d.Item(arr(i, 2)) >= arr(i, 3) Then
- arr(i, 4) = arr(i, 3)
- arr(i, 5) = "是"
- d.Item(arr(i, 2)) = d.Item(arr(i, 2)) - arr(i, 3)
- Else
- arr(i, 4) = d.Item(arr(i, 2))
- arr(i, 5) = "否"
- d.Item(arr(i, 2)) = 0
- End If
- Else
- arr(i, 4) = 0
- arr(i, 5) = "否"
- End If
- Next
-
- Rem 输出到 Sheet3
- Sheet3.Select
- With Range("A2:E" & Range("A1").CurrentRegion.Rows.Count)
- .ClearContents
- .Borders.LineStyle = xlNone
- End With
- With Range("A2").Resize(UBound(arr), UBound(arr, 2))
- .Value = arr
- .Borders.LineStyle = xlContinuous
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|