Dies sollte tun, was Sie suchen. Ich habe den Code kommentiert, damit Sie genau lesen können, was passiert. Beachten Sie, dass dieser Code die Range-Typvariable verwendet. Dies bedeutet, dass die Variablen rTransfer und rOriginal auf tatsächliche Zellen im Arbeitsblatt verweisen.
Hoffe das hilft! Viel Glück!
Sub TransferMyData() 'Declare the variables to be used in the code Dim wsTransfer As Worksheet, wsOriginal As Worksheet Dim rTransfer As Range, rOriginal As Range, rCopyRange As Range Dim dMonday As Variant Dim iRow As Integer 'Set the worksheet variable, this makes is easier than constantly referencing each sheet in the code all the time Set wsTransfer = ThisWorkbook.Worksheets("Transfer") Set wsOriginal = ThisWorkbook.Worksheets("Original") 'Set rOriginal to reference range E8, the first cell we are checking for a date to transfer Set rOriginal = wsOriginal.Range("E8") 'Run this loop over and over until the cell referenced in rOriginal is blank. 'At the bottom of the loop we shift rOriginal down by one Do While rOriginal <> "" 'Find the Monday of the week for rOriginal dMonday = rOriginal - Weekday(rOriginal, 3) 'Format dMonay to match the Transfer worksheet - Commented out 'dMonday = Format(dMonday, "dd-mm-yy") 'Set the cell of rTransfer using the Find function (Search range A:A in wsTransfer for the monday we figured out above) Set rTransfer = wsTransfer.Range("A:A").Find(dMonday) 'Error check. If rTransfer returns nothing then no match was found If rTransfer Is Nothing Then MsgBox ("Can't find the Monday for ") & rOriginal & ". Searching for Value " & dMonday Exit Sub End If 'Check if there was already some data transfered in for that week (rTransfer.Offset(1,4) references the 'E' column of the row below). 'If there is a value there, shift down by one and check again Do Until rTransfer.Offset(1, 4) = "" Set rTransfer = rTransfer.Offset(1, 0) Loop 'Insert a blank row below rTransfer using the offset function rTransfer.Offset(1, 0).EntireRow.Insert 'Set iRow to be the row number of rOriginal to be used below iRow = rOriginal.Row 'Set the range rCopyRange to be the range A:H of the row for iRow (See https://www.mrexcel.com/forum/excel-questions/48711-range-r1c1-format-visual-basic-applications.html for explanation) Set rCopyRange = wsOriginal.Range(Cells(iRow, 1).Address, Cells(iRow, 8).Address) 'Copy the range rCopyRange into the blank row we added rCopyRange.Copy rTransfer.Offset(1, 0) 'Offset our rOriginal cell down by one and restart the loop Set rOriginal = rOriginal.Offset(1, 0) 'Clear out the copied range. Can replace with rCopyRange.Delete if you want to delete the cells and have everything shift up rCopyRange.Clear 'Simple error check, if for some reasone you're stuck in an endless loop this will break out If rOriginal.Row > 999 Then MsgBox "Error! Stuck in Loop!" Exit Sub End If Loop End Sub