+ Reply to Thread
Results 1 to 15 of 15

splitting text into rows.

  1. #1
    Registered User
    Join Date
    07-18-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    splitting text into rows.

    Hi all,

    I'm new to VBA and I'm looking for a macro which would do the following:

    I have this:
    555545, 4555
    42225, 44
    4444, 5, 4445, 88, 986

    and I want this:

    555545
    4555
    42225
    44
    4444
    5
    4445
    88
    986


    Many thanks in advance!

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: splitting text into rows.

    Assuming your list starts in A1:

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    07-18-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: splitting text into rows.

    This worked perfectly! Thank you very much. What if the list doesn't start from A1 and starts from A5?

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: splitting text into rows.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-18-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: splitting text into rows.

    Thanks again for your prompt response. Another question related to this topic. What if I would like to do this for multiple columns, A, B & C all at once?

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: splitting text into rows.

    Can you post a before and after of the start and end results you want like you did in your first post?

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: splitting text into rows.

    FWIW:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-18-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: splitting text into rows.

    Thanks but this is not what I was looking for. The Macro provided by John H. Davis moved all the values to Column A.

    This is what I have:

    115, 54 454, 245, 5454 545
    45, 548, 855 45 10, 11
    45, 5 2 3, 4

    And this is what I want:

    115 454 545
    54 245 10
    45 5454 11
    548 45 3
    855 2 4
    45
    5

  9. #9
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: splitting text into rows.

    Try this:

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  10. #10
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: splitting text into rows.

    @stnkynts: Beautiful approach, put me to shame this time. Nice job.

  11. #11
    Registered User
    Join Date
    07-18-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: splitting text into rows.

    This is not working for me . I might have to edit it based on the way my data is set up. Could you explain what Cells(5,i) is referring to?

    Thanks!

  12. #12
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: splitting text into rows.

    @walrus. Thank you kindly

    @rose. In general terms Cell(5, i) is a range which is further defined by the integer i, which based upon the loop is either 1, 2, or 3. When i is 1 the range will be Cells(5, 1) otherwise known as A5.

  13. #13
    Registered User
    Join Date
    07-18-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: splitting text into rows.

    @stnkynts - Thanks for your explanation. But unfortunately, the code is not working for me. It is only inputting one value for cell A5; and all other cells (A1:C3) remains the same.

    @stnkynts and/or @walruseggman - Can you write similar to what @walruseggman had provided earlier?

    Thanks!

  14. #14
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: splitting text into rows.

    It is only inputting one value for cell A5; and all other cells (A1:C3) remains the same.
    You previously indicated you wanted it to start at row 5 and so I coded it to start at row 5. If you want it to start at row 1 you would need to change the code to reflect this:

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    07-18-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: splitting text into rows.

    @stnkynts - This worked perfectly! Thank you!

+ 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. Splitting an 8 sheet WB with 46,000 rows into smaller WB with 1000 rows?
    By Konakick in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-16-2015, 08:11 PM
  2. Splitting rows with multiple columns into seperate rows for time points.
    By mbracha in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-16-2013, 10:06 AM
  3. Macro splitting comma delimated cell text into rows with other row data copied...
    By geoffffffff in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-13-2013, 11:07 AM
  4. [SOLVED] Splitting text from one cell into separate text fragments, Located in adjacent cells
    By onsid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2013, 08:32 PM
  5. Splitting one row into two rows
    By Adrow1x in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-21-2012, 04:48 PM
  6. Splitting a row into 2 rows
    By dilly.sg in forum Excel General
    Replies: 1
    Last Post: 05-29-2012, 12:26 AM
  7. Replies: 3
    Last Post: 11-13-2009, 12:05 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