+ Reply to Thread
Results 1 to 4 of 4

Removing blank lines from string

  1. #1
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    184

    Removing blank lines from string

    I have a texfile that populates a textbox on a userform. I would like to remove all blank lines in the string including those at the end if they exist, before populating the textbox. I'm reading the entire file at once into the string, not line by line.

    Is there any way to edit the string called Text to remove the blank lines before populating the textbox? I'm looking for 2 carriage return characters in a row, and if so then remove one of them, but I don't know how to code that. This is in the userform activate section.

    If I read the textfile line by line, I don't know how to populate the textbox that way and remove the blank lines.

    Please Login or Register  to view this content.
    Please see the example workbook and textfile.
    Attached Files Attached Files
    Last edited by proepert; 02-17-2010 at 04:12 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Removing blank lines from string

    I had a play and this seems to work for your example:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    184

    Re: Removing blank lines from string

    Wow that was fast and spot on. Thank you very much.
    I've been to London about 8 times, love the city.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Removing blank lines from string

    My pleasure. Next time you visit you can buy me a pint!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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