PDA

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



l4l4l4
09-15-2020, 09:37 PM
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
2712227123

Since I can't attach the worksheet, so here's the capture file
271242712527126

Can anybody see anything immediatley wrong?

Thanks

Paul_Hossler
09-16-2020, 06:52 AM
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