I want to copy a particular row (one that meets the "IF" criteria) from one workbook and paste it to a particular tab of another workbook. In the another workbook, where I intend to paste the copied row, I want to do it over a dynamic range,wherein I can vary the row number after completion of every "IF" loop.
To do this I wanted to specify the cell locations in the range where the copied stuff is to be pasted.Here I want to keep incrementing the row by one unit every loop but want to keep the column number fixed.
I am pasting the code below:
Sub trial()
Dim i As Integer
Dim x As Integer
Dim y As Integer
Dim R As Range
y = 20
For i = 2 To 100
x = Cells(i, 2)
If x = 1 Then
Range(Cells(i, 7), Cells(i, 16)).Copy
Workbooks("Cardine5H.xlsx").Activate
ActiveSheet.Paste Destination:=Worksheets("Jan-11").Range(Cells(y, 3), Cells(y, 12))
y = y + 1
End If
Next i
End Sub
Bookmarks