Try the attached
Sub test()
Dim r As Range, a, i As Long, ii As Long, w
Dim txt As String, dic As Object
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
For Each r In Columns(1).SpecialCells(2).Areas
If Not r.MergeCells Then
a = r.CurrentRegion.Value
ReDim w(1 To UBound(a, 2))
If Not dic.exists("Summary") Then
w(1) = Format$(CDate(Right$([a1], 11)) _
, """Summary for Month of"" mmmm")
dic("summary1") = w: w(1) = Empty
dic("summary2") = w
For ii = 1 To UBound(a, 2)
w(ii) = a(1, ii)
Next
dic("summary3") = w
End If
For i = 2 To UBound(a, 1)
txt = Join(Array(a(i, 1), a(i, 2)), Chr(2))
If Not dic.exists(txt) Then
ReDim w(1 To UBound(a, 2))
w(1) = a(i, 1): w(2) = a(i, 2)
Else
w = dic(txt)
End If
For ii = 3 To UBound(a, 2)
w(ii) = w(ii) + a(i, ii)
Next
dic(txt) = w
Next
End If
Next
With [h1].Resize(dic.Count, UBound(a, 2))
.CurrentRegion.EntireColumn.Clear
.Value = Application.Index(dic.items, 0, 0)
With .Rows("1:3")
.Rows(1).HorizontalAlignment = 7
.Interior.Color = 10213316
.Font.Bold = True
.Rows(1).BorderAround Weight:=2
.Rows(2).BorderAround Weight:=2
End With
With .Offset(2)
.Resize(.Rows.Count - 2).Borders.Weight = 2
.Columns.AutoFit
End With
End With
End Sub
Bookmarks