Another method for building this type of table is to use the Dictionary Object, e.g:
Public Sub Example()
Dim oDic As Object
Dim rngCell As Range
Dim vStr As Variant, vKey As Variant
Dim lngKey As Long
Set oDic = CreateObject("Scripting.Dictionary")
With Sheets("Sheet1")
.Columns("O:P").Clear
For Each rngCell In .Range(.Cells(2, "D"), .Cells(.Rows.Count, "D").End(xlUp))
With oDic
.CompareMode = vbTextCompare
v = rngCell.Value & "-" & rngCell.Offset(, 9).Value
If Not .exists(v) Then
.Add v, 1
Else
.Item(v) = .Item(v) + 1
End If
End With
Next rngCell
With oDic
ReDim vKeys(1 To .Count, 1 To 2)
For Each vKey In .Keys
lngKey = lngKey + 1
vKeys(lngKey, 1) = vKey
vKeys(lngKey, 2) = .Item(vKey)
Next vKey
End With
Set oDic = Nothing
.Cells(1, "O").Resize(, 2).Value = Array("Device", "MyCount")
.Cells(2, "O").Resize(UBound(vKeys, 1), 2).Value = vKeys
End With
End Sub
You could iterate the Dictionary and write straight back to Sheet rather than use Array, however, less to / fro Worksheet / VBE using the Array (ie single update).
Bookmarks