+ Reply to Thread
Results 1 to 4 of 4

Thread: Selecting Filtered range only

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    183

    Selecting Filtered range only

    Hi all, I'm sure this question must have been asked before but I can't find the answer.

    I have some code already that filters a data set by the criteria "yesterday" in column A.

    The results it returns can vary from 0 rows to over 100 - and the row numbers can be different each time.

    I need a bit of code to complete my formula - I need the code to select the rows that have been filtered by my existing code (yesterday date entries) and copy them (if copying by rows isn't practical then the colum range is A:R)

    If there are 0 rows then to stop the macro, if there is only 1 row then it needs to be copied. I don't want to include the headers in row 1.

    Please can someone help me with this

  2. #2
    Registered User
    Join Date
    01-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Selecting Filtered range only

    Try this in your VBA

    Loop While ActiveCell.EntireRow.Hidden = True

  3. #3
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2003, Excel 2007 (Portable)
    Posts
    388

    Re: Selecting Filtered range only

    Hi
    You can use advance filter

    A macro is wtitten in the attached

    Regard
    Attached Files Attached Files
    Last edited by mahju; 02-01-2012 at 10:47 AM. Reason: Corrected
    Mahju

    Mark the thread as solved if you are satisfied with the answer

    Rule 9
    Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  4. #4
    Valued Forum Contributor
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2003 and reluctantly Excel 2007
    Posts
    631

    Re: Selecting Filtered range only

    You could try
    Set Rng = ActiveSheet.AutoFilter.Range
       Rng.Offset(1, 0).Resize(Rng.Rows.Count - 1).Copy
    Alf

+ 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.2.0