|
参与一下。。。。- Sub ykcbf() '//2024.8.13
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("单台配电箱柜组价表")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 9)
- End With
- ReDim brr(1 To 10000, 1 To 8)
- For i = 2 To UBound(arr)
- If Val(arr(i, 2)) Then k = k + 1: d(k) = i
- Next
- For k = 1 To d.Count
- r1 = d(k)
- If k = d.Count Then r2 = r Else r2 = d(k + 1) - 1
- m = m + 1
- brr(m, 1) = "低压配电箱/柜"
- brr(m, 2) = arr(r1, 3)
- brr(m, 3) = arr(r1, 7)
- brr(m, 5) = arr(r1, 5)
- brr(m, 6) = arr(r2, 7)
- brr(m, 7) = brr(m, 5) * brr(m, 6)
- brr(m, 8) = arr(r1, 8)
- For i = r1 + 1 To r2 - 1
- If arr(i, 2) = "箱柜" Then brr(m, 4) = arr(i, 3)
- Next
- Next
- With Sheets("报价汇总表")
- .[b3:i10000].ClearContents
- .[b3].Resize(m, 8) = brr
- End With
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
|