Results 1 to 3 of 3

Advanced Filter Macro (only returns column headings)

Threaded View

Mufasta Advanced Filter Macro (only... 08-05-2011, 07:17 PM
Colin Legg Re: Advanced Filter Macro... 08-06-2011, 05:08 AM
Mufasta Re: Advanced Filter Macro... 08-06-2011, 11:56 AM
  1. #1
    Registered User
    Join Date
    08-05-2011
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    2

    Advanced Filter Macro (only returns column headings)

    Hello all, 1st time poster so please be patient with me.

    I was wondering if anyone could help me solve an issue I'm having with creating a macro to filter some data from one sheet to another. I used the "record a macro" function to get the code I've posted below but when I run the macro, it only gives me headings of the columns in the "Inputs" sheet .

    In my workbook I have a main sheet called "Inputs" and another sheet called "Sheet1". The code below works when I manually apply an advanced filter (Data>> Advanced>>Ok) but does not do what I need it to do when I run the macro.

    I have created Named Ranges entitled "Data", "Criteria" and "Extract"

    Sub Macro2()
    '
    ' Macro2 Macro
    '
    ' Keyboard Shortcut: Ctrl+d
    '
        Range("Data").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
            "Criteria"), CopyToRange:=Range("Extract"), Unique:=False
    End Sub
    I checked this against a 2nd macro in which I didn't use the named ranges. Again the same result: When I apply the advanced filter manually, it works. When I run the filter from the macro, it gives me the headings of the columns in the "Inputs" tab.

    Sub Macro3()
    '
    ' Macro3 Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+S
    '
        Sheets("Inputs").Columns("A:V").AdvancedFilter Action:=xlFilterCopy, _
            CriteriaRange:=Range("A7:B8"), CopyToRange:=Sheets("Sheet1").Range("A10:V10"), Unique:= _
            False
    End Sub

    I would like an amendment to the above macos that will allow the correct data to be displayed for the relevant criteria. I know I've probably left something basic out, but I just can't figure out what despite trawling through forums and comparing other peoples codes to mine. Any help would be greatly appreciated.

    My thanks in advance
    Nick
    Attached Files Attached Files
    Last edited by Mufasta; 08-06-2011 at 11:54 AM.

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