+ Reply to Thread
Results 1 to 7 of 7

Omend code to include 2 rows above found row.

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Omend code to include 2 rows above found row.

    Hi I have below code. It search in sheet 2 column E to L after the input word. When found it copy all rows (Column E to L, Sheet2), with the found word to Sheet 3. Column E to L.

    I need this to include the first 2 above rows with colorindex 38.
    So example if it find name Peter in sheet 2 row E10:L10. then it have to include the 2 rows above with color index 38.

    And the same for the next found Peter
    Have a look at the test sheet.
    Thanks in advance
    Abjac

    My code.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Omend code to include 2 rows above found row.

    Hi Abjac,
    try it
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Omend code to include 2 rows above found row.

    Hi Nilem. Its a great code, I just made a little mistake. Can your code be changed so it only copy the rows with the name Peter. Where there is text in one of the cells from F to L. There is a little change in the testsheet below where you can see what i want.Please have a look.
    Sincerely
    Abjac
    Attached Files Attached Files

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Omend code to include 2 rows above found row.

    try
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Omend code to include 2 rows above found row.

    HI Nilem. Its working perfect really great wow. It only have a little problem it also copy from cell B and C. If you try to put some value in to example B3 , B5; C3 ; C5 it will copy them also.
    And also a little request. Is it possible to make a blank row after Peter to the next 2 colored and Peter, so its seperated?
    Sincerely
    Abjac

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Omend code to include 2 rows above found row.

    Okay, try
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Omend code to include 2 rows above found row.

    HI Nilem and thanks allot. It really works just perfect. It have a little thing with the inserted row. It copy the colorindex also there. But i think i can fix that. Thanks allot for you help.

    Have a nice day

    Sincerely
    Abjac

+ 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