Results 1 to 3 of 3

Thread: Excel VBA: Copy multiple Column of a Table
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2019
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Excel VBA: Copy multiple Column of a Table

    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.

  2. #2
    MrExcel MVP
    Join Date
    Apr 2006
    Posts
    19,699
    Post Thanks / Like
    Mentioned
    15 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Excel VBA: Copy multiple Column of a Table

    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 by pgc01; Sep 19th, 2019 at 01:32 PM.
    Kind regards
    PGC

    To understand recursion, you must understand recursion.

  3. #3
    MrExcel MVP
    Join Date
    Apr 2006
    Posts
    19,699
    Post Thanks / Like
    Mentioned
    15 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Excel VBA: Copy multiple Column of a Table

    Similar if you want to use .DataBodyRange

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

    To understand recursion, you must understand recursion.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •