i am a absolute newbie in VBA. I want to add more than one value in the Dictonary to group a table with the same values by the Amount of the items. So I have this table
1 10 A5 Text1 Audi1 Auto1 100
2 10 A5 Text1 Audi1 Auto1 100
3 10 A5 Text1 Audi1 Auto1 100
4 10 A4 Text4 Audi4 Auto4 200
5 10 A6 Text5 Audi5 Auto5 300
6 10 A6 Text5 Text5 Text5 300
7 10 A5 Text1 Audi1 Auto1 100
8 10 A4 Text4 Audi4 Auto4 200
9 10 A2 Text9 Audi9 Auto9 50
10 10 A1 Text10 Audi10 Auto10 25
now i want to group then together an it should look like this:
1 40 A5 Text1 Audi1 Auto1 100
2 20 A4 Text4 Audi4 Auto4 200
3 20 A6 Text5 Audi5 Auto5 300
4 10 A2 Text9 Audi9 Auto9 50
5 10 A1 Text10 Audi10 Auto10 25
My actaul VBA is this:
Sub Schaltfläche1_Klicken()
Dim WkSh As Worksheet
Dim aTemp As Variant
Dim lZeile As Long
Dim rZelle As Range
Dim Dict As Variant
Set WkSh = ThisWorkbook.Worksheets("Tabelle1")
With WkSh ' die Fahrzeuge aus A2:Bn in einen temporären Array schreiben
aTemp = .Range("B13:G" & .Cells(.Rows.Count, 1).End(xlUp).Row)
End With
WkSh.Range("B13:G1000").ClearContents ' den Bereich D2:E100 leeren/löschen
Set Dict = CreateObject("Scripting.Dictionary")
On Error Resume Next
' die Daten an das Dictionary übergeben
For lZeile = 1 To UBound(aTemp)
Dict(aTemp(lZeile, 2)) = Dict(aTemp(lZeile, 2)) + aTemp(lZeile, 1)
Next lZeile
'
' ausgeben
'
Set rZelle = WkSh.Cells(13, 2) ' Bereich festlegen wo hingeschrieben werden soll Beispiel: cells(5,1) -> Reihe 5 Spalte 1
'
Application.EnableEvents = False
rZelle.Resize(Dict.Count) = WorksheetFunction.Transpose(Dict.Items)
rZelle.Offset(0, 1).Resize(Dict.Count) = WorksheetFunction.Transpose(Dict.Keys)
Application.EnableEvents = True
End Sub
And give me this Output:
1 40 A5
2 20 A4
3 20 A6
4 10 A2
5 10 A1
Can someone please help me, to achive my wanted output.

