|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- Set d3 = CreateObject("scripting.dictionary")
- Set d4 = CreateObject("scripting.dictionary")
- With Worksheets("问题明细")
- arr = .Range("h2:h4")
- For i = 1 To UBound(arr)
- If Len(arr(i, 1)) <> 0 Then
- d1(arr(i, 1)) = ""
- End If
- Next
- .Range("i10:bp41").ClearContents
- brr = .Range("h8:bp41")
- For i = 3 To UBound(brr) - 2
- d2(brr(i, 1)) = i
- Next
- For j = 2 To UBound(brr, 2)
- xm = brr(1, j) & "+" & brr(2, j)
- d3(xm) = j
- Next
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:d" & r)
- For i = 1 To UBound(arr)
- If d1.exists(arr(i, 4)) Then
- If d2.exists(arr(i, 1)) Then
- m = d2(arr(i, 1))
- Else
- m = d2("其他")
- End If
- xm = arr(i, 2) & "+" & arr(i, 3)
- If d3.exists(xm) Then
- n = d3(xm)
- brr(m, n) = brr(m, n) + 1
- End If
- End If
- Next
- End With
- With Worksheets("生产数量")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:c" & r)
- For i = 1 To UBound(arr)
- If d1.exists(arr(i, 3)) Then
- xm = Replace(arr(i, 1), ".", "+")
- d4(xm) = d4(xm) + arr(i, 2)
- End If
- Next
- End With
- For j = 2 To UBound(brr, 2)
- For i = 3 To 32
- brr(33, j) = brr(33, j) + brr(i, j)
- Next
- xm = brr(1, j) & "+" & brr(2, j)
- If d4.exists(xm) Then
- brr(34, j) = d4(xm) - brr(33, j)
- End If
- Next
- With Worksheets("问题明细")
- .Range("h8:bp41") = brr
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|