+ Reply to Thread
Results 1 to 5 of 5

Code that will select and copy only so many rows

  1. #1
    Forum Contributor
    Join Date
    04-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    161

    Code that will select and copy only so many rows

    I need code that will look for a number in cell C1 and then it starts at C9
    selecting cells to copy until it sees a cell with a number larger than what is in C1 and stops.
    i need code for this since the number in C1 is always changing


    Example: if there is an 18 in C1 it selects all cells that are >0 and <19

    these cells are always sorted 123456........36 they are not random in order like 1 17 6 12 18 4 3



    I have attached a sample file so you can better understand what i am looking for. Thanks
    Attached Files Attached Files
    Last edited by Traymond; 04-23-2009 at 12:30 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Code that will select and copy only so many rows

    Are all the numbers concerned always integers?

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Code that will select and copy only so many rows

    you could use a function try
    =IF(ROW()-7<=MATCH(Sheet1!$C$1,Sheet1!$C$9:$C$1000),Sheet1!C9,"")
    in a8 sheet 2 dragged down as far as you think you'll need (you could increase Sheet1!$C$9:$C$1000 if you want)
    Last edited by martindwilson; 04-23-2009 at 11:57 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Contributor
    Join Date
    04-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Code that will select and copy only so many rows

    yes always integers

  5. #5
    Forum Contributor
    Join Date
    04-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Code that will select and copy only so many rows

    I can make that function work for me.
    Thanks for the help and quick response

+ 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