Hallo,
in dem Fall schaut die Lösung anders aus:
Sub CopyIST()
Dim wshData As Worksheet
Dim rngDest As Range, rng As Range
Dim iSrcCol As Integer, iRow As Integer
Dim datValue As Date
Set wshData = Tabelle4
Set rngDest = Tabelle3.Range("B5:O25")
datValue = DateAdd("d", -13, DateAdd("d", -1, Date))
iSrcCol = 2
For Each rng In rngDest.Columns
Do While wshData.UsedRange.Columns.Count >= iSrcCol
If wshData.Cells(5, iSrcCol).Value = datValue Then
' Copy Data from wshData in rngDest
For iRow = 1 To rng.Rows.Count
rng.Cells(iRow, 1).Value = wshData.Cells(4 + iRow, iSrcCol).Value
Next
datValue = DateAdd("d", 1, datValue)
Exit Do
Else
iSrcCol = iSrcCol + 1
End If
Loop
Next
End Sub
Kurze Erläuterung:
Es wird jede Spalte in der Tabelle4
LG, Ben
|