Gruppe
Allgemein
Problem
Die Werte aus Spalte A:B sollen in Tabelle2 komprimiert angeordnet werden.
StandardModule: Modul1
Sub Transformieren()
Dim vRow As Variant
Dim iRow As Integer, iRowL As Integer, iCol As Integer
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
iCol = 1
With Worksheets("Tabelle2")
For iRow = 1 To iRowL
If Not IsNumeric(Cells(iRow, 1)) Then
iCol = iCol + 1
.Cells(1, iCol).Value = Cells(iRow, 2).Value
Else
vRow = Application.Match(Cells(iRow, 1).Value, .Columns(1), 0)
If Not IsError(vRow) Then
.Cells(vRow, iCol).Value = Cells(iRow, 2).Value
End If
End If
Next iRow
End With
End Sub