+ Reply to Thread
Results 1 to 3 of 3

VBA Loop: Insert Row based on Criteria

  1. #1
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    111

    VBA Loop: Insert Row based on Criteria

    Hello

    It is final, I cannot master loops, they just do not make sense to me for whatever reason.

    We have a custom system that has been modified to present a report that is one step from being able to be uploaded. This reports is usually 50 - 75 transactions long and is being manually and incorrectly changed each week it is run.

    I need a macro that will start at the top of column A, ignore the header and run a macro until it reaches the last instance of a find function. Each time it finds the criteria it inserts a row above and adds a name to the field

    1. Find: "TRNS"
    2. Insert an entire row above the "TRNS" line.
    3. Select the Cell in Column A of the new line and type "ENDTRNS"
    4. Move on to the next instance and repeat until the last instance of "TRNS"

    I think this is going to be the best way. The other option is to look for "SPL" and add a line below, but there are instances where more than one "SPL" exists in a row and that code that i have tried just really messes with the end result.

    I have attached a sheet with the data source and the end result as it should look.

    Thanks for any help you can give.

    Adam
    Attached Files Attached Files
    Last edited by Ada01; 01-25-2013 at 12:37 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: VBA Loop: Insert Row based on Criteria

    Hi

    The code below does what I think you want, but doesn't give the same result as your output. Can you explain why the TRANS in Output!A16 doesn't have an ENDTRANS immediately above?

    Please Login or Register  to view this content.
    rylo

  3. #3
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    111

    Re: VBA Loop: Insert Row based on Criteria

    I will give that a try . Thanks!

    The missing endtrns is part of why I want a macro the works ... Eliminate errors like that one

+ 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