+ Reply to Thread
Results 1 to 11 of 11

Script to Copy from Column B and past in new Row underneath Column A

  1. #1
    Registered User
    Join Date
    09-09-2011
    Location
    Arizona, United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Question Script to Copy from Column B and past in new Row underneath Column A

    I have a large spreadsheet full of data where a list of names are in single cells of data and I would like all of the names to have their own row so that I can sort the data. I was able to deliminate the names to columns, there is up to 5 columns of names per row now. Some have only 1 and some have 2 or 3 and some have 5.

    I would like to use a macro that would check columns B-F in a row and if it contains additional names in those rows, to cut (or copy) them and insert new row underneath and place the names in column A in the new rows so that all names have their own rows of data. So if Row 2 had text in all five columns. The macro would insert 5 rows underneath row 2 and paste the data from column B to row 3 and from column C to row 4 ... and so on. Then the formula would go on to the next row of data and check to do the same. There would be a caveat where it would simply skip over and go to the next if there is no data in rows B-F or if there is only 3 columns of data, I would like it to do just the three columns that have names and then go to the next (not insert 5 rows for each line item when there is blank data (although I suppose I can go back and filter them out). This macro would have to loop until all rows are complete.

    Any suggestions on how to write this? Thank you!

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Script to Copy from Column B and past in new Row underneath Column A

    No need to split the data into separate columns, you can use
    Please Login or Register  to view this content.
    This assume the delimiter is a comma, if not change the comma in red to suit

  3. #3
    Registered User
    Join Date
    09-09-2011
    Location
    Arizona, United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Script to Copy from Column B and past in new Row underneath Column A

    Quote Originally Posted by Fluff13 View Post
    No need to split the data into separate columns, you can use
    Please Login or Register  to view this content.
    This assume the delimiter is a comma, if not change the comma in red to suit
    Except I have large amounts of data in columns G through X and I don't want those to be touched. I want to copy them down to the added rows later (or if the formula can do it, have the formula do it. But they would go in columns G through X in the added rows.

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Script to Copy from Column B and past in new Row underneath Column A

    Possibly...
    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Script to Copy from Column B and past in new Row underneath Column A

    How about
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-09-2011
    Location
    Arizona, United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Script to Copy from Column B and past in new Row underneath Column A

    Quote Originally Posted by Fluff13 View Post
    How about
    Please Login or Register  to view this content.
    I think you are on the right track with this, the delimiter is actually spaces, however and the macro is not picking that up if I change "," to " "

    I am trying to upload an example file but the forum is not letting me.

    There are thousands of rows with a column that has names like this:

    Jim James
    Jo Joe Johanna Hanna
    Dave David Davidson

    I want to make it:

    Jim
    James
    Jo
    Joe
    Johanna
    Hanna
    Dave
    David
    Davidson

    Meanwhile not losing the unique data in the columns to the right and copying them down. The macros are not recognizing the random spaces as the delimiter which is why I am thinking I have to go text-to-columns first? Or I can clean up the cells and make a comma delimiter.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Script to Copy from Column B and past in new Row underneath Column A

    This works for me with spaces
    Please Login or Register  to view this content.
    If that doesn't work
    To upload a workbook

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  8. #8
    Registered User
    Join Date
    09-09-2011
    Location
    Arizona, United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Script to Copy from Column B and past in new Row underneath Column A

    Attached is an example of what I am trying to do. sorry about that, thank you!
    Attached Files Attached Files

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Script to Copy from Column B and past in new Row underneath Column A

    Thanks for the file, how about
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-09-2011
    Location
    Arizona, United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Script to Copy from Column B and past in new Row underneath Column A

    Quote Originally Posted by Fluff13 View Post
    Thanks for the file, how about
    Please Login or Register  to view this content.
    This works! Thank you very much for your help! Sorry I didn't lead with my excel file earlier!

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Script to Copy from Column B and past in new Row underneath Column A

    Glad to help & thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy-past of a row from a sheet to another, based on the value in the first column.
    By marcomajo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2018, 11:32 AM
  2. [SOLVED] Copy from Excel to Reflection, simple Copy & past script ... Help Please : )
    By strik009 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-15-2015, 02:15 PM
  3. Automatic COPY and PAST entire Column to another sheet column
    By irfanfun in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2014, 09:38 AM
  4. Copy & Past to the last row of a certain column
    By IKZOUHETNIETWETEN in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-03-2013, 10:44 PM
  5. VBA Copy and past with in a Column of a sheet
    By _google in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2013, 02:13 PM
  6. Copy&Past Cell Value from one Column to another using VBA
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2009, 01:45 PM
  7. macro to copy a column and put it underneath another
    By cadalist in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2007, 06:59 PM

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