Gruppe
Allgemein
Problem
Die Daten aus zwei Blättern sollen im Blatt Daten zusammengefaßt werden.
StandardModule: Modul1
Sub Zusammenfuehren()
Dim iRow As Integer, iRowS As Integer, iRowT As Integer
Dim wksA As Worksheet, wksB As Worksheet
Set wksA = Worksheets("Artikel")
Set wksB = Worksheets("Daten")
iRowT = 1
iRow = 2
Do Until IsEmpty(Cells(iRow, 1))
iRowS = 2
Do Until IsEmpty(wksA.Cells(iRowS, 1))
If Cells(iRow, 1).Value = wksA.Cells(iRowS, 1).Value Then
iRowT = iRowT + 1
wksB.Cells(iRowT, 1).Value = Cells(iRow, 1).Value
wksB.Cells(iRowT, 2).Value = Cells(iRow, 2).Value
wksB.Cells(iRowT, 3).Value = Cells(iRow, 3).Value
wksB.Cells(iRowT, 4).Value = wksA.Cells(iRowS, 2).Value
wksB.Cells(iRowT, 5).Value = wksA.Cells(iRowS, 3).Value
End If
iRowS = iRowS + 1
Loop
iRow = iRow + 1
Loop
End Sub