B23------C23------------E25------- F23-------G23-------H23-----I23
Nr. - Bezeichnung - Gebinde - Menge - Gesamt - KG - -- Liter
bis B37 - I37 können Datenn stehen
Danke
Carola
Option Explicit
Sub Uebertragen()
Dim zQ&, zZ&, spZ%
spZ = 2 ' in "Artikel" ab 2. Spalte einfügen
Sheets("Artikel").Activate
With Sheets("Tabelle2") ' Quelltabelle
zZ = Cells(Rows.Count, spZ).End(xlUp).Row
For zQ = 23 To 37
If Not IsEmpty(.Cells(zQ, 2)) Then
Range(.Cells(zQ, 2), .Cells(zQ, 8)).Copy
zZ = zZ + 1
Cells(zZ, spZ).PasteSpecial xlPasteValues
End If
Next zQ
Application.CutCopyMode = False
Cells(zZ + 1, spZ).Select
End With
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-LintfortOption Explicit
Sub kopieren()
Dim zQ&, zZ&
Sheets("Rechnungen Gesamt").Activate
With Sheets("Rechnung") ' Quelltabelle
zZ = Cells(Rows.Count, 2).End(xlUp).Row ' letzte Zeile Zieltabelle
For zQ = 23 To 37
If Not IsEmpty(.Cells(zQ, 2)) Then
zZ = zZ + 1
Cells(zZ, 1) = .Cells(18, 8) ' Datum
Cells(zZ, 2) = .Cells(zQ, 2) ' Artikel
Cells(zZ, 3) = .Cells(zQ, 3) ' Bezeichnung
Cells(zZ, 4) = .Cells(zQ, 4) ' Gebinde
Cells(zZ, 5) = .Cells(zQ, 5) ' Menge
Cells(zZ, 6) = .Cells(zQ, 7) ' Preis/Einh
Cells(zZ, 7) = .Cells(zQ, 8) ' Gesamt
Cells(zZ, 8) = .Cells(13, 7) ' Kd-Nr
Cells(zZ, 9) = .Cells(13, 3) ' Name
Cells(zZ, 10) = .Cells(15, 7) ' Kd-Nr
End If
Next zQ
Cells(zZ + 1, 1).Select 'nicht nötig, aber vielleicht gewünscht
End With
End Sub