Consulting

Results 1 to 2 of 2

Thread: Run-time error 1004: The extract range has a missing or invalid field name

  1. #1
    VBAX Newbie
    Joined
    Sep 2020
    Posts
    1
    Location

    Run-time error 1004: The extract range has a missing or invalid field name

    Hello all.
    I'm trying a VBA formula to filter data. I'm stuck because I cannot comprehend what Excel wants. Here's the formula

    Sub CodingFiterData ()
    range ("MasterData").AdvancedFilter action:=xlFilterCopy, criteriarange:=range("Criteria"),copytorange :=range("Result"), unique:=false
    End Sub

    Then when I strated the formula, notification appears like this
    VBA Error Notification.jpgdebug Error Notification.jpg

    Since I can't attach the worksheet, so here's the capture file
    masterdata.jpgCriteria.PNGresult.jpg

    Can anybody see anything immediatley wrong?

    Thanks

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    I'm guessing it's because your 'MasterData' is not a list: one set of headers with same kind of data below
    Yours is formatted into logical 'blocks' by ASSET ID

    Or ... your 'Criteria' is Statement = 'Jane', but the data uses 'Name'

    Or .. both

    Use a list format like 'Results' and add a 'Statement' or 'Name' in Col B, mayne 'Asset Date' in Col C. Store your all your data for everything there

    Filter should work that way. You can also use that list format with pivot tables for presentation and analysis

    If you can post a sample workbook, it'd be easier to tell
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •