|
- Sub gj23w98()
- Set d = CreateObject("scripting.dictionary")
- arr = [a12].CurrentRegion
- ReDim brr(1 To UBound(arr), 1 To 5)
- For i = 2 To UBound(arr)
- s = arr(i, 3)
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- For j = 1 To 4
- brr(m, j) = arr(i, j)
- Next
- brr(m, 5) = arr(i, 6)
- Else
- brr(d(s), 4) = brr(d(s), 4) + arr(i, 4)
- End If
- Next
- With Sheets(2)
- If m Then
- .[a12].CurrentRegion.Offset(1).Clear
- .[a13].Resize(m, 5) = brr
- .[a13].Resize(m, 5).Borders.LineStyle = 1
- .[a13].Resize(m, 5).HorizontalAlignment = xlCenter
- .[a13].Resize(m, 5).VerticalAlignment = xlCenter
- End If
- Application.DisplayAlerts = False
- r = .Cells(.Rows.Count, 1).End(3).Row
- For i = r - 1 To 13 Step -1
- If .Cells(i, 1) = .Cells(i + 1, 1) Then .Range(.Cells(i, 1), .Cells(i + 1, 1)).Merge
- Next
- Application.DisplayAlerts = True
- End With
- End Sub
复制代码 |
|