+ Reply to Thread
Results 1 to 6 of 6

Copy a certain number of rows containing data after a filter is applied.

  1. #1
    Registered User
    Join Date
    07-19-2012
    Location
    Corning, New york
    MS-Off Ver
    Excel 2010
    Posts
    3

    Copy a certain number of rows containing data after a filter is applied.

    I have a spreadsheet that contains a list of items available from a storeroom. I would to be able to filter a quantity column to show any nonblanks and then copy the rows over to another sheet. I have the code created for this but here is my problem. How do I select the rows when the row numbers will change? Depending which rows have a number in them the rows present after the filter will change. I need to copy the rows that are not blank no matter of the rows number. Below is the code I have so far, the line I am having problems with is "Range("A2:D4").Select". I have also attached a small example of what i working with. The actual spreadsheet has hundreds of possible rows.
    Store.xls
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Copy a certain number of rows containing data after a filter is applied.

    Try this
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    07-19-2012
    Location
    Corning, New york
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copy a certain number of rows containing data after a filter is applied.

    Thanks for the help on this but I am getting a "run time error 438 Object doesn't support this property or method" when i run this line [ActiveSheet.SpecialCells(xlCellTypeVisible).Copy]. I changed the line to read [ActiveSheet.Cells.SpecialCells(xlCellTypeVisible).Copy] but that tries to select everything. I also have a header row that i don't want to copy over.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Copy a certain number of rows containing data after a filter is applied.

    Try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-19-2012
    Location
    Corning, New york
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copy a certain number of rows containing data after a filter is applied.

    This worked great with the exception of, it selects 1 empty row below the rows with text. For what i need i can live with an additional empty row. Thanks for the help.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Copy a certain number of rows containing data after a filter is applied.

    @ Tazdvl1124

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

+ 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