I developed a script by looping method to copy data from one sheet to another and then refresh the first field. The script works well except for one issue. Within the second sheet it is supposed to find the last non blank cell in column A (i.e. 'x') and past the data from next row. The problem is that it is pasting the data in 'x + 11' row.
I need help identifying why this is occuring.
Note that here i = 11 because the data in row 10 is a header and the required data starts from 11th row.
Here is the macro I have made:
Option Explicit
Sub CopyPaste()
Dim i As Integer
Dim x As Long
Dim y As Long
Dim c As Range
i = 11
Do While Cells(i, 1).Value <> ""
'ActiveSheet.CopyPast
x = i
y = 0
For Each c In Worksheets("CDS").Range(Cells(x, 1), Cells(x, 11))
Worksheets("DataBank").Range("a10000").End(xlUp).Offset(x, y) = c
y = y + 1
x = 0
Next c
Application.CutCopyMode = False
i = i + 1
Loop
With Sheets("CDS")
Range("A11:K65").ClearContents
End With
End Sub