+ Reply to Thread
Results 1 to 7 of 7

splitting multi-line cell into newly created rows

  1. #1
    Registered User
    Join Date
    07-15-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    splitting multi-line cell into newly created rows

    I am working on an excel spreadsheet that has data in 17 columns. Some of these columns, say column AJ, contain multiple dates on each line (ALT-Enter) within the cell. Suppose cell A and B contain only one entry, like name and phone number for a person, which are attributed to all lines in AJ.

    In other words, I want the code to do the following:

    ttt.jpg

    Please note that the number of lines (dates) differ across the data so the code needs to figure out how many dates there are and create new rows accordingly.

    Any help is greatly appreciated!

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: splitting multi-line cell into newly created rows

    You say some of these columns contain multiple entries. How many, and which ones? Your request could be accomplished if applied to one column, but with a random number up to 17, it gets tricky, especially if more than one cell in a single row has multiple entries. For example, if column X has 2, Y has 5, and Z has 10, then I assume you would want that row expanded to 10 rows, but what would you do with the data in columns X and Y?
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    07-15-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    Re: splitting multi-line cell into newly created rows

    Thank you natefarm for the quick reply.
    Apologies, I should have been more elaborate in my explanation. The number of columns that needs this kind of treatment is fixed (3 columns out of the 17) and I do not mind running the code one column at a time. Each row will contain the same number of entries in the cells that need to be treated so I will not run into the issue you mentioned with a single row having columns that contain different number of entries per cell.
    To illustrate, I attached a sample file of what I am talking about.
    Columns A, B, and H have cells that need to be split, with the other columns basically replicating their cell entries in the newly created cells. The entries on each line map 1-to-1 across columns A,B and H. Notice how each row does not have a varying number lines.
    I hope this makes the problem more manageable.

    Thanks again natefarm.
    Attached Files Attached Files

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: splitting multi-line cell into newly created rows

    Hi tranzsport,
    try it
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-15-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    Re: splitting multi-line cell into newly created rows

    Excellent nilem!
    Thanks! It worked on the sample file..
    can you kindly (very quickly) which part of the code I need to tweak as it seems to break if I had additional columns or if my treatment columns were in different positions/arrangement.
    I basically would like to know what to tweak in the code to make it fit a different arrangement or number of treatment columns.
    again, thanks! you are awesome

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: splitting multi-line cell into newly created rows

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-15-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    4

    Re: splitting multi-line cell into newly created rows

    that did the trick!
    Thanks, much appreciated..

+ 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 Rows by Cell Value, Paste to Newly Created Worksheet, Email Contents
    By TylerK_BLL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2015, 03:40 PM
  2. [SOLVED] Email newly created line in excel workbook
    By klospros in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 11-21-2014, 11:48 AM
  3. Automatically filling newly created rows
    By xvxixcxtxoxr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2013, 04:43 AM
  4. [SOLVED] Insert Row based on Condition and add data in the newly created rows
    By Omariss in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-16-2013, 04:27 AM
  5. [SOLVED] Splitting multi-line cells into rows and moving the values into another column
    By Gav74 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2013, 09:59 AM
  6. Splitting multi-line cells into separate rows
    By jazzper in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-23-2009, 06:19 PM
  7. Replies: 3
    Last Post: 06-07-2005, 09:05 AM

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