+ Reply to Thread
Results 1 to 3 of 3

Copying and appending non contiguous colums to a new worksheet

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Copying and appending non contiguous colums to a new worksheet

    Hi,

    I'm a beginner to VBA programming and macros and I think I have a scenario that is a little out of my league. Looking for assistance/direction or suggestions. It is even a little difficult to explain, but here goes.

    I am looking to copy non contiguous columns from a worksheet to another worksheet in the same workbook. For example, copying columns A, B, C and column F then looping through again to append to that list in the new spreadsheet, columns A, B, C and column G and so on for the range F2:H2.

    I would suspect the logic may be something like this:


    for i = (F2 to H2)
    for j = (row 4 to row 100) ** the number or rows is not static, it could vary due to insertions and deletions. **
    F2, row 4 ** create new row **
    F2, row 5 ** create new row **
    ....
    G2, row 4
    G2, row 5

    The row that is copied would select cells from non contiguous columns in the original spreadsheet. Perhaps, copying out the whole row would be easiest then deleting the necessary columns.

    I have attached an example of the worksheet and what the new spreadsheet should look like.

    Thanks!
    KevinSample data.xlsx
    Last edited by Kespin; 09-21-2012 at 10:15 AM.

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Copying and appending non contiguous colums to a new worksheet

    Give this a shot

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Registered User
    Join Date
    09-19-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copying and appending non contiguous colums to a new worksheet

    That works great. Thanks Mike!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1