|
- Sub 价格统计表()
- Dim a, b, c, i, j
- Dim arr, brr, crr
- Application.ScreenUpdating = False
- arr = Sheets("BOM表").[a1].CurrentRegion
- Sheets("价格统计表").Range("a1").AutoFilter
- ReDim crr(1 To 1000, 1 To 6)
- j = 1
- For a = 8 To UBound(arr, 2) Step 4
- i = arr(1, a) & arr(2, a) & arr(3, a) & arr(4, a)
- brr = Sheets("价格统计表").[a1].CurrentRegion
- th = False
- For b = 1 To UBound(brr)
- c = brr(b, 1) & brr(b, 2) & brr(b, 3) & brr(b, 4)
- If c = i Then
- brr(b, 5) = arr(6, a + 1)
- brr(b, 6) = arr(6, a + 3)
- th = True
- End If
- If b = UBound(brr) And th = False Then
- crr(j, 1) = arr(1, a)
- crr(j, 2) = arr(2, a)
- crr(j, 3) = arr(3, a)
- crr(j, 4) = arr(4, a)
- crr(j, 5) = arr(6, a + 1)
- crr(j, 6) = arr(6, a + 3)
- j = j + 1
- End If
- Next b
- Next a
- Sheets("价格统计表").[a:q].NumberFormat = "@"
- Sheets("价格统计表").[a1].Resize(UBound(brr), UBound(brr, 2)) = brr
- Sheets("价格统计表").Cells(UBound(brr) + 1, 1).Resize(j, 6) = crr
- Sheets("价格统计表").Range("a1").AutoFilter
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|