PDA

View Full Version : Copy Table Range Till Last Row Using VBA



ivandgreat
05-09-2013, 01:31 AM
Hi,

Good day! I would like to loop on my table that will transfer the row data to sheet2 up to the last end value.

br,

ivan

Excel Fox
05-09-2013, 10:16 AM
Sub MoveTableEntire()

With Worksheets("Sheet1")
.Range("A1:F1").Copy Worksheets("Sheet2").Range("A1")
.Range("A2:F" & Application.Max(2, .Cells(.Rows.Count, 1).End(xlUp).Row)).Copy Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2)
End With

End Sub

ivandgreat
05-09-2013, 05:41 PM
Thanks Excel Fox,
But what i need is the output should be like in Col I to Col O, sorry i wasn't able to explain it well.

The logic is to check the first row with value in col B and lookup the next value in col C up to the last value which Col C is not available in Col B.

br,