+ Reply to Thread
Results 1 to 7 of 7

Macro to Copy Many Columns Contents and Combing them in 1 column

  1. #1
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Macro to Copy Many Columns Contents and Combing them in 1 column

    Was looking into this, but basically i have a repetitive task of copying contents from various columns, and pasting them into 1 column.

    1 right after the other. I figured there could be a way for a macro to copy contents from multiple columns and paste them into 1 column.

    I have including 2 files, 1 from the start of the file, and 1 how it should be so it will have clarify what i am trying to do.

    So basically if you open book1 , i have factory install tabs,

    I need the columns contents from the first tab the (5k-20k) starting with Column B, then E, then H, and so on( Every 3rd column starting with B ) to be copied and pasted in Column A of the (Factory Install Tab) ( last tab ).

    If you open the 2nd file this will be clearly understood. In the second file in the factory install tab you will notice i did the first 2. I highlighted each starting part in yellow just so its easier to see. SO in column A you should have all the contents in the 5k-20k tab ( starting with b every 3rd ), pasted in column A 1 after the other.

    The next tab is the 30k tab, i need all of the columns contents copied starting with B ( every 3rd again ), copied in Column C of the Factory Install tab. Basically every tab's contents needs to have its own column in the Factory Install tab.

    If anyone could help that would be great, this is a very time consuming process manually, and it would seem like a macro could be made to easily copy contents.

    Thanks
    Attached Files Attached Files
    Last edited by donnydorko; 02-10-2009 at 05:30 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Macro to Copy Many Columns Contents and Combing them in 1 column

    Hi

    Try this.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Macro to Copy Many Columns Contents and Combing them in 1 column

    Works Perfectly, in copying all the data into 1 column from all sheets. But i was also wondering if each tab could be displayed in a seperate column . For Example i wanted the 30k tab to be displayed in Column C, the 60k Tab in Column E, ( every other column in other words , that way if i find a problem with a certain tab, i can just go to the column and find the mistake . Otherwise i will have 12000 rows of data all the tabs in 1 column instead of seperated. If not i understand.


    Also could u describe the process of how this is working? the reason i ask if suppose i add sheets after the factory install tab, will it copy those, or if i add sheets before the 5k 20k sheets. Because some files i work with have other tabs before and after which i do not need to copy over. ( if there is an easy way to specify which tabs to do this with perhaps? ). Also if i change the names of any tabs does it effect this macro.

    Thanks
    Last edited by donnydorko; 02-09-2009 at 11:05 PM.

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Macro to Copy Many Columns Contents and Combing them in 1 column

    Hi

    Updated.

    Please Login or Register  to view this content.
    This will put the output for each sheet in its own column, and row 1 will show the name of the sheet that the data came from.

    This process cycles through all the sheets except the last one. So there is an assumption that the last sheet will always be the output sheet. It doesn't matter what the order is, it will just take them in sequence.

    If you only have specific sheets you want to action, is there some naming convention that you can use to distinguish them? Say any sheet that has Factory Install in the name, but the output sheet will always be Factory Install? If so, then it is pretty easy to reconfigure to do something like that.

    Another way is to have a couple of dummy sheets that bracket the ones you want to action. So it would action all the sheets between those dummy ones.

    rylo

  5. #5
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Macro to Copy Many Columns Contents and Combing them in 1 column

    How about this, the tabs i want have factory in it, ( assume all the install's in the tabs will be removed now ) so for example the tabs will all say factory ( then the milage ).


    The sheet i want it to copy the info to will be named "factory install "

    I will have another group of tabs which i want this to work with which will have tier 2 in their names . And the sheet for this to be pasted in will be called tier2 install.

    I've included a worksheet to better demonstrate.

    Essentially , the tabs in green with factory in it are the ones to be copied,and pasted in the factory install. and the tabs in blue with tier2 in it will be pasted in the tier2 install.

    I planned to recopy the module and change the sheets for it to run for the tier 2 group. Hence why i needed to know which area of the code picks specific sheets so i could have 1 a seperate macro for the factory group, and 1 for the tier2 group.

    Thanks
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Macro to Copy Many Columns Contents and Combing them in 1 column

    i just noticed RYU that the copied contents ( the numbers are not displaying 2 decimal places like the original tabs had on some areas. i believe this is due to the fact that it just paste specialed values and not the formats also. ( not sure though, but those numbers needs to be the same format ( decimal places ect ) , as the original tab. Ok i think i figured that part out, did a pastevalues and number formats.


    Please Login or Register  to view this content.
    Last edited by donnydorko; 02-10-2009 at 02:56 PM.

  7. #7
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Macro to Copy Many Columns Contents and Combing them in 1 column

    actually this is perfect as it is, love this, thanks again RYLO! you rock.
    Last edited by donnydorko; 02-10-2009 at 08:22 PM.

+ 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