Dim
Name, Wert
Sub
Start()
Dim
Bis
Bis = 0
Range(
"A1"
).
End
(xlDown).
Select
Bis = ActiveCell.Row
For
x = 2
To
Bis
Name = Range(
"A"
& x)
Wert = Range(
"B"
& x)
Verarbeitung
Next
x
End
Sub
Sub
Verarbeitung()
Dim
Bis2
Bis2 = 0
Sheets(
"Tabelle2"
).
Select
Range(
"A1"
).
End
(xlDown).
Select
Bis2 = ActiveCell.Row
If
Bis2 > 100
Then
Bis2 = 2
Range(
"A"
& Bis2) = Name
Range(
"B"
& Bis2) = Wert
Range(
"A2:B"
& Bis2).
Select
Selection.Sort Key1:=Range(
"A2"
), Order1:=xlAscending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=
False
, Orientation:=xlTopToBottom, DataOption1 _
:=xlSortNormal
Sheets(
"Tabelle1"
).
Select
Exit
Sub
End
If
For
y = 2
To
Bis2
Step
1
If
Range(
"A"
& y) = Name
Then
Range(
"B"
& y) = Range(
"B"
& y) + Wert
Sheets(
"Tabelle1"
).
Select
Exit
Sub
End
If
Next
y
Range(
"A"
& Bis2).
Select
If
Bis2 > 1
Then
_
Selection.Offset(1, 0).Range(
"A1"
).
Select
Bis2 = ActiveCell.Row
Range(
"A"
& Bis2) = Name
Range(
"B"
& Bis2) = Range(
"B"
& Bis2) + Wert
Range(
"A2:B"
& Bis2).
Select
Selection.Sort Key1:=Range(
"A2"
), Order1:=xlAscending, Header:=xlGuess _
, OrderCustom:=1, MatchCase:=
False
, Orientation:=xlTopToBottom, DataOption1 _
:=xlSortNormal
Sheets(
"Tabelle1"
).
Select
End
Sub