+ Reply to Thread
Results 1 to 6 of 6

Look for specific text string, insert row below, insert text to that row

  1. #1
    Registered User
    Join Date
    01-13-2014
    Location
    Pensacola, USA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Question Look for specific text string, insert row below, insert text to that row

    Hello everyone,

    I need to modify some very large router configurations for 20+ routers and need to look for a string, for examples sake: String: primary "igp", does the next row contain the text adaptive? no, insert a row below it, and add the word, adaptive, if it does contain adaptive, move on. The reason for needing to search for the text strings is that some of the data will already contain the word adaptive and doesn't need to change, and the row count between the text may change if additional commands are on that configuration. Meaning I can't do a "count 10 rows, insert row, insert text" type macro, it has to look for the text strings.

    Book2.xlsm

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Look for specific text string, insert row below, insert text to that row

    This uses the .Find method

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

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

    Re: Look for specific text string, insert row below, insert text to that row

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-13-2014
    Location
    Pensacola, USA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Look for specific text string, insert row below, insert text to that row

    Quote Originally Posted by AlphaFrog View Post
    This uses the .Find method

    Please Login or Register  to view this content.
    AlphaFrog,

    This is very close, but when I run the code it finds primary "igp" and inserts blank row, but doesn't put the word adaptive, it does however leave the rows alone that already have adaptive. Can you have a second look?

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Look for specific text string, insert row below, insert text to that row

    Quote Originally Posted by jwats View Post
    AlphaFrog,

    This is very close, but when I run the code it finds primary "igp" and inserts blank row, but doesn't put the word adaptive, it does however leave the rows alone that already have adaptive. Can you have a second look?
    I missed that part. Sorry.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-13-2014
    Location
    Pensacola, USA
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Look for specific text string, insert row below, insert text to that row

    Perfect my friend! Worked just as intended on my test data. I will do some testing with it to make sure I can't break it, lol one must be very careful running a production routers config through Excel

+ 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. Macro that will insert a simple text string in top cell of text file
    By Davek11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-25-2014, 07:31 PM
  2. Insert text before the last item in a string
    By jwac in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-26-2013, 02:33 PM
  3. String If text insert date
    By trent241 in forum Excel General
    Replies: 4
    Last Post: 05-12-2012, 12:47 PM
  4. Excel 2007 : Insert Text into string
    By skidz in forum Excel General
    Replies: 5
    Last Post: 11-12-2010, 12:56 PM
  5. insert spaces into text string
    By mmwltd in forum Excel General
    Replies: 6
    Last Post: 04-27-2010, 01:05 PM
  6. How do I insert content of a2 into text string in b2 and so on?
    By Allenc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-05-2006, 07:30 PM
  7. Insert characters in a text string
    By jamae918 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2005, 05:06 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