+ Reply to Thread
Results 1 to 8 of 8

Insering newline at every space

  1. #1
    Registered User
    Join Date
    10-23-2012
    Location
    LON
    MS-Off Ver
    Excel 2003
    Posts
    29

    Unhappy Insering newline at every space

    I have a text file with data arranged in the following order:

    Name Address Name Address Name Address ... so on

    I want to arrange it like:

    Name
    Address
    Name
    Address
    Name
    Address
    .
    .
    .
    so on

    How can I achieve this using VBA??
    I figured out that at every space, if I insert a new line than it will be solved.. but no idea how to do that??

    So my program is required to check a text file and insert a newline at every space it finds


    Regards

  2. #2
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003, 2010
    Posts
    212

    Re: Insering newline at every space

    post a sample file...

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,028

    Re: Insering newline at every space

    You can Split them like this:

    Please Login or Register  to view this content.
    Never use Merged Cells in Excel

  4. #4
    Registered User
    Join Date
    10-23-2012
    Location
    LON
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Insering newline at every space

    Quote Originally Posted by Rem0ram View Post
    post a sample file...
    sample file is attached

    Data.txt

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

    Re: Insering newline at every space

    Does this help?

    Please Login or Register  to view this content.
    assumes original data is on row 2.

  6. #6
    Registered User
    Join Date
    10-23-2012
    Location
    LON
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Insering newline at every space

    Quote Originally Posted by JOHN H. DAVIS View Post
    Does this help?

    Please Login or Register  to view this content.
    assumes original data is on row 2.

    Not working
    Last edited by mandukes; 12-05-2013 at 08:15 AM.

  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: Insering newline at every space

    Maybe:

    Please Login or Register  to view this content.
    Assumes original data is on row 2 of a spreadsheet.

  8. #8
    Registered User
    Join Date
    10-23-2012
    Location
    LON
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Insering newline at every space

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    Assumes original data is on row 2 of a spreadsheet.
    Thank you It works

    but it needs to be done in the "text file". When the program runs it would open the text file and do necessary changes and save the file.
    Maybe I'm asking too much :P
    but thanks for the code

+ 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. How to replace space with newline
    By utpalmtbi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-11-2013, 09:13 PM
  2. [SOLVED] Problem in insering header picture in word through excel
    By spmltr in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-22-2012, 05:48 AM
  3. Insering empty rows after each
    By HarryKlein in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-31-2011, 06:20 AM
  4. insering empty row based on a condition
    By darkhorse4321 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2010, 02:16 AM
  5. Insering an image on a specific cell
    By Moiz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2005, 07:10 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