+ Reply to Thread
Results 1 to 7 of 7

Moving Strings on new line if condition is met

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Moving Strings on new line if condition is met

    Hello all,

    I am looking for a way to place all text after, for example: "WR", on a new line.

    THIS:
    RG PKJ23459934787TH EGH WR JHG473829TH HJU

    SHOULD BE:
    RG PKJ23459934787TH EGH
    WR JHG473829TH HJU

    It should only do this when it is preceeded by a dash or space

    THE FOLLOWING SHOULD NOT BE PUT ON A NEW LINE:
    RG PKJ23459934787TH EGH RWR JHG473829TH HJU

    The rule should only be applied after the following codes:
    WR, AM, KJ, KO, QD, CF, VG, RD, PL, QM, ZF, SS, DP

    All help is welcome

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

    Re: Moving Strings on new line if condition is met

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Moving Strings on new line if condition is met

    Thank you for replying.

    I made a mistake, I meant a new row instead of a new line (sorry)

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

    Re: Moving Strings on new line if condition is met

    Maybe:

    Please Login or Register  to view this content.
    Assumes A2
    Last edited by JOHN H. DAVIS; 06-05-2015 at 02:04 PM.

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

    Re: Moving Strings on new line if condition is met

    Please Login or Register  to view this content.
    Last edited by stnkynts; 06-05-2015 at 03:55 PM.

  6. #6
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Moving Strings on new line if condition is met

    The following code does exactly what I need, however, I would like it to delete rows where no match is found.
    Any ideas?

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Moving Strings on new line if condition is met

    The following code does exactly what I need, however, I would like it to delete rows where no match is found.
    Any ideas?

    Please Login or Register  to view this content.

+ 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] Extract Values between two Text Strings, MULTIPLE condition
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-28-2015, 01:28 AM
  2. Replies: 0
    Last Post: 02-19-2014, 03:49 PM
  3. [SOLVED] Moving Contents of Line to End of Previous Line in Word 2010 doc
    By staggers47 in forum Word Formatting & General
    Replies: 4
    Last Post: 12-15-2012, 09:17 AM
  4. Strings, counting and moving words
    By rs585832 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2011, 09:36 AM
  5. Count text strings that meet a condition
    By dcgrove in forum Excel General
    Replies: 4
    Last Post: 09-14-2010, 03:38 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