+ Reply to Thread
Results 1 to 6 of 6

How to replace space with newline

  1. #1
    Registered User
    Join Date
    11-11-2013
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2003
    Posts
    2

    How to replace space with newline

    Hi all,

    I have space separated characters in A1 as:

    Red Blue .. ..

    I want to replace space in newline in new column cell, such as :
    Red <---- in A1
    Blue <---- in A2

    I try replace space with "ctrl+j", but replaced characters remain in a single cell..

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to replace space with newline

    Hi
    this macro should take the contents of cell A1 and type all the separate "words" (separated by spaces) in successive rows starting in B1:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-11-2013
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: How to replace space with newline

    Thanks.. It works fine for one cell, but I have many such cells (from A2 to BWM2), and want to convert them simultaneously..

    Could the name name and destination be set as such?

    Set SourceCell = Range("A2") 'address of cell to split
    Set DestCell = Range("A3") 'address of first cell to copy to

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to replace space with newline

    it can be tweaked - do you want all the the split values to continue in the same column; if so, try this:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: How to replace space with newline

    @Nicky, I'm not sure you need both loops, maybe you can do something like this:
    Please Login or Register  to view this content.
    Which might be a little quicker.

  6. #6
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: How to replace space with newline

    Thanks yudlugar
    Yes – that’s a more economical way to do it!

+ 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. [SOLVED] How to substitute a comma with a newline char using Replace.
    By edspyhill01 in forum Excel General
    Replies: 10
    Last Post: 12-13-2012, 06:39 PM
  2. replace space in string with non-space
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2012, 02:59 AM
  3. replace double space with single space within a range
    By erikd80 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-05-2011, 01:20 PM
  4. Search / Replace with NewLine
    By drew138 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-11-2009, 08:42 PM
  5. [SOLVED] Replace a ; with a , and a space
    By Jo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-22-2005, 10:06 AM

Tags for this Thread

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