+ Reply to Thread
Results 1 to 5 of 5

How to select 'found range' and the row above it (selecting two rows)

  1. #1
    Forum Contributor
    Join Date
    06-24-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    124

    How to select 'found range' and the row above it (selecting two rows)

    Hi there

    I have the following code to find and copy a row if it meets the "What" criteria, however I would like to copy the row directing above the 'found' range as well.
    Any help would be greatly appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to select 'found range' and the row above it (selecting two rows)

    Please Login or Register  to view this content.
    Looks wrong to me

    If it is a variable, what is the name of the variable?

    May be
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-24-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    124

    Re: How to select 'found range' and the row above it (selecting two rows)

    Thanks for the quick Reply!

    I have no variables declared in this code. (is it recommended to declare these?)

    My code works on the 'found' range; I recorded a 'Find' in the worksheet, then altered the code to loop it.

    If you have an idea of a simpler code to use which searches a Worksheet for the phrase "Teacher is principal" then moves that row and and row above to a different worksheet, please let me know.

    Cheers
    Dan

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to select 'found range' and the row above it (selecting two rows)

    This code copies the entire row plus the row above.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-24-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    124

    Re: How to select 'found range' and the row above it (selecting two rows)

    Thank you very much !

    The code worked perfectly!!

    Cheers
    Dan

+ 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. How to determine range to select once a reference cell is found?
    By ivoryg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-31-2012, 10:29 AM
  2. Delete rows if found in a range
    By ssmith001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2007, 07:13 PM
  3. [SOLVED] Select Range found by Vlookup
    By JG Scott in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2006, 01:10 PM
  4. selecting a range-, I want it to select I3: to the end of the column.
    By jhahes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2005, 03:57 PM
  5. How to set range to number of rows found?
    By ljCharlie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2005, 01:28 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