+ Reply to Thread
Results 1 to 10 of 10

Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

  1. #1
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Hi

    I have a value (which can change) in cell B2 of Sheet("CALCS2 ALL"). I would like to search within a specified range (e.g. A:Q) for the value contained in B2. If found, I would like to cut the row containing the value, search for another value (e.g. Apples) in column E and insert the cut row above the row which has 'Apples' in column E.

    Any help appreciated.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Hi StevoDE

    Is the range A:Q in the same sheet....Is it from a specific row
    Is the search for Apples in Col E in the same sheet?
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    All in the same sheet Sintek.

    I can probably be a bit more specific come to think of it. We only need to search in column E with the data starting at E14. The number of rows containing data is dynamic however the macro sorts the data such that the value being searched for will almost certainly be in the last used row in Col E before any blanks. i.e. if using 'end.(xldown)' starting at E14, the value will always be at the bottom of that range.

    I hope that makes sense.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Sort of...What about the A:Q Range
    Surely the search will always first find B2 as it is in the A:Q Range or does A:Q Range also start from 14 down.
    Perhaps you can upload a sample workbook so that we can see the setup

  5. #5
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Apologies, ignore A:Q. The data starts at E14. I want to first search for the value contained in cell B2 and the range I am looking is the used range of column E starting at E14.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Now I'm just confused...
    You want to search for a value found in [B2] in Range E14 down and then find "Apples" in Range E14 down and paste the found B2 Row value above apples?

  7. #7
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Exactly that yes. Cut the full row containing found B2 value and paste above the row containing apples.
    Last edited by stevoDE; 06-14-2017 at 11:20 AM.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Perhaps this?
    Can't say without a sample workbook.
    Please Login or Register  to view this content.


    Edited...
    Surely "Apples" also changes so perhaps that needs to be stored in a cell too...

  9. #9
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    Perfect, thanks Sintek.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Search Range for Value Contained in a Cell then Cut/Paste Row Where Value is Found

    So I assume it works. Glad I could help. please mark thread as solved and add rep +

+ 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. Search for value in a range and overwrite if found and create new if not found
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-04-2016, 01:19 PM
  2. [SOLVED] Search for the first cell that contained a specific text
    By Dena in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2014, 01:46 PM
  3. Find Cell Value in Workbook; Paste Cell Range When Found
    By bbarber71389 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2014, 04:18 PM
  4. [SOLVED] Macro to search for value contained in a cell
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-17-2012, 09:47 AM
  5. Check range for number if found paste data into cell
    By Sal1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2011, 03:29 PM
  6. Replies: 4
    Last Post: 05-12-2011, 02:25 PM
  7. [SOLVED] Search a Range for a phrase and Format cell if found
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2005, 06:05 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