Results 1 to 11 of 11

Macro to search a string, then search above for another one and copy the rows between them

Threaded View

  1. #1
    Registered User
    Join Date
    11-14-2012
    Location
    Lima, Peru
    MS-Off Ver
    Excel 2007
    Posts
    5

    Macro to search a string, then search above for another one and copy the rows between them

    Good night,
    Im having a really hard time trying to figure out how to make a Macro to Search for a Substring then search the rows above for a different one and finally select the cells until a third criteria is met, after the selection is made copy this to a different sheet based on another string that must be searched.

    Lets say this is the info from the Data Sheet all the information for every row is on the same cell in column A, the number of rows between the "----" and the number of total rows are not always the same, sometimes there are blank rows in the data. For the Example we'll use 3 aditional sheets "P", "O" and "I".

    ----
    P11
    111
    11x
    111
    ----
    O11
    111
    11z
    ----
    I11

    11x
    ----

    What I'm looking for is a way to search for "X", then search the cells above for "----" and made a selection til the next "----" cell, when this is made, search inside the selection for "P", "O" or "I", and copy the selection to the sheet with the same name, then repeat the process until all the rows are done. Using the info above the macro should encounter the first "X" on the 4th row then search above and select from the 1st to 6th row and copy this selection to Sheet "P".

    Thanks for your time.
    Attached Files Attached Files

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