Excel VBA: Copy multiple Column of a Table

wsw979

New Member
I am trying to use VBA coding to copy a table to another table. But I am only interested in copying row 2 to row 20 (minus Header and row 1) to another table. I understand there is a function .databodyrange, but this will copy every data in the table which is not what I am looking for.
 

pgc01

MrExcel MVP
Hi
Welcome to the board

See if this helps:

Code:
Dim lstO As ListObject

Set lstO = ActiveSheet.ListObjects("MyTable")

lstO.Range.Offset(2, 0).Resize(18).Copy Destination:=Range("Z1")
 
Last edited:

pgc01

MrExcel MVP
Similar if you want to use .DataBodyRange

Code:
lstO.DataBodyRange.Offset(1, 0).Resize(18).Copy Destination:=Range("Z1")
 

Some videos you may like

This Week's Hot Topics

Top