+ Reply to Thread
Results 1 to 3 of 3

Insert row if text doesn't exist

  1. #1
    Registered User
    Join Date
    07-17-2009
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Insert row if text doesn't exist

    Hi All,

    I have an Excel sheet that looks like this:
    A1
    Section 1
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    Section 2
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    Section 3
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>

    This goes on until section 18.

    What I would like to do is have a macro check if a certain section exists e.g. section 3, if it does the macro should do nothing, but if it doesn't the macro should insert a row above the following section and put the section name in the newly inserted row in colum A e.g.

    If the sheet looks like this:

    Section 1
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    Section 3
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>

    I would like to search for "section 2" and recieive the follwoing result:

    Section 1
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    Section 2
    Section 3
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>
    <empty cell>

    I don't know if this can be done by writing a macro as I am a complete noob but any help would be greatly appreciated.

    Thank you very much for any assistance.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Insert row if text doesn't exist

    Try this.

    Please Login or Register  to view this content.
    Martin

  3. #3
    Registered User
    Join Date
    07-17-2009
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Insert row if text doesn't exist

    That works great. Thank you very much.

+ 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