+ Reply to Thread
Results 1 to 7 of 7

Copy Data from Several Columns with Same Header into One Column

  1. #1
    Registered User
    Join Date
    01-18-2013
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    5

    Copy Data from Several Columns with Same Header into One Column

    Ok, this is a tricky one. I have a spreadsheet that is working with assy's and subassy's. Column B, C, & D are titled "SubAssy", "Qty", "Notes" respectively. Coulmns E,F, & G are also called that. How can I write a code that would copy all the data in every column named Subassy and place in on another column on "Sheet2". I have found a code that show does it for the first 3 columns, but stops there:

    Sheets("Sheet1").Select
    subassy = WorksheetFunction.Match("Sub Assy", Rows("1:1"), 0)
    qty = WorksheetFunction.Match("Qty Per", Rows("1:1"), 0)
    note = WorksheetFunction.Match("Notes", Rows("1:1"), 0)

    Sheets("Sheet1").Columns(subassy).Copy Destination:=Sheets("Sheet2").Range("A1")
    Sheets("Sheet1").Columns(qty).Copy Destination:=Sheets("Sheet2").Range("B1")
    Sheets("Sheet1").Columns(note).Copy Destination:=Sheets("Sheet2").Range("C1")



    Anyone know how to get this to go to the next group of three comumns???

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy Data from Several Columns with Same Header into One Column

    attach a sample file with current and desired sheet
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    01-18-2013
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy Data from Several Columns with Same Header into One Column

    Sample file attached. The done in it already does some of the work, but I need to go to the second set of data.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy Data from Several Columns with Same Header into One Column

    are the columns titled "SubAssy", "Qty", "Notes" always in the same position, let say
    CDE, FGH, IJK ... ?

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy Data from Several Columns with Same Header into One Column

    This code copies an entire column if the column header is "Subassy"

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-18-2013
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy Data from Several Columns with Same Header into One Column

    If that makes it easier, then yes

  7. #7
    Registered User
    Join Date
    01-18-2013
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy Data from Several Columns with Same Header into One Column

    I actually figured it out doing it another way, which is much more simple. Since each row has it's own unique data, I was able to use the following:

    =TRIM(CONCATENATE(Breakdown!A2,Breakdown!E2,Breakdown!I2,Breakdown!M2,Breakdown!U2,Breakdown!AC2))

    That did exactly what I was trying to do. Thanks to all who replied.

    Tom

+ 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