|
- Sub 测试()
- Dim i%, j%, k%, m%, n%, arr, brr, crr, drr
- Dim rng As Range, sht As Worksheet, wbk As Workbook
- Dim dic As Object, key, keys, items
- Set dic = CreateObject("scripting.dictionary")
- ReDim brr(1 To 7)
- For i = 1 To Sheets.Count
- Set sht = Sheets(i)
- If sht.Name <> "销控表" Then
- arr = sht.Range("A1").CurrentRegion.Value
- For j = 4 To UBound(arr)
- key = arr(j, 12)
- If Not dic.Exists(key) Then
- brr(1) = key
- brr(2) = arr(j, 3)
- brr(列号(arr(j, 10))) = arr(j, 9)
- dic(key) = brr
- Else
- brr = dic(key)
- brr(列号(arr(j, 10))) = brr(列号(arr(j, 10))) + arr(j, 9)
- dic(key) = brr
- End If
- Next
- End If
- Next
- keys = dic.keys
- ReDim crr(1 To 1000, 1 To 7)
- For i = LBound(keys) To UBound(keys)
- key = keys(i)
- brr = dic(key)
- k = k + 1
- For j = 1 To 7
- crr(k, j) = brr(j)
- Next
- Next
- Sheet1.Range("A2").Resize(UBound(crr), 7) = crr
- End Sub
- Function 列号(s)
- Select Case s
- Case Is = "购房款"
- 列号 = 3
- Case Is = "工本费"
- 列号 = 4
- Case Is = "维修基金"
- 列号 = 5
- Case Is = "办证费"
- 列号 = 6
- Case Is = "车位款"
- 列号 = 7
- End Select
- End Function
复制代码 |
|