Announcement

Collapse
No announcement yet.

Advanced Filter - Extract Range Has A Missing Or Illegal Field Name

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Advanced Filter - Extract Range Has A Missing Or Illegal Field Name



    Morning All,

    I'm using the below code to paste unique values from column 'D' to cells 'A6001:A11000'.

    I'm getting the following error message:

    Run-Time error '1004'

    The Extract Range Has A Missing Or Illegal Field Name

    Can anybody see anything immediatley wrong?

    Code:
    ActiveSheet.Range("D:D").Select
        Columns("D:D").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
            "A6001:A11000"), Unique:=True

  • #2
    Re: Advanced Filter - Extract Range Has A Missing Or Illegal Field Name

    There are links in Possible Answers section at the bottom of this thread that address this very topic. Have you tried them?

    You don't need to select cells in VBA, just reference them and act on them. Also, it is best to set the paste range as a single cell and let Excel adjust the size of the paste range.

    Code:
    ActiveSheet.Columns("D:D").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("A6001"), Unique:=True
    Last edited by AAE; August 27th, 2010, 21:30.
    AAE
    ----------------------------------------------------

    Forum Rules | Message to Cross Posters | How to use Tags

    Comment


    • #3
      Re: Advanced Filter - Extract Range Has A Missing Or Illegal Field Name

      I've looked at the previous posts and it doesn't really help. My data range has a header. Can't seem to work out why its not working!

      Comment


      • #4


        Re: Advanced Filter - Extract Range Has A Missing Or Illegal Field Name

        Try:

        1. Press Ctrl + F3 keys to open the Name Manager
        2. Delete the extract range
        3. Select the paste range (A6001 to end of the column) and delete the cells
        4. Save and close the workbook
        5. Reopen and try running the filter

        If this doesn't work, you should upload a sample workbook.

        I would also add to the code this line to clear the paste range so that it only contains the recent filter results.
        Code:
        Range("A6001:A" & Cells(Rows.Count, "A").End(xlUp).Row).ClearContents
        AAE
        ----------------------------------------------------

        Forum Rules | Message to Cross Posters | How to use Tags

        Comment

        Working...
        X