Reputation: 5355
I am trying to implement a filter system in my excel sheet.
However, I am hanging at displaying the data:
Sub FilterData()
Sheets("App").Select
Range("B12").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Clear
Sheets("RawData").Range("Table1[#All]").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Sheets("RawData").Range("M1:P2"), CopyToRange:=Sheets("App").Range("B12"), Unique:=True
Columns.AutoFit
Range("B12").Select
End Sub
The function is take from:
The error looks like that:
Any suggestion what could be wrong? What could I check to get much deeper information?
I appreciate your answer!
UPDATE
Pls have a look at my named ranges:
UPDATE 2 The error:
Upvotes: 0
Views: 170
Reputation: 3084
I hope this article will help you
Especially this part
Error Enabler
This section invokes the error handler:
On Error GoTo PROC_ERR
If an error occurs in the procedure, the code jumps to the line where the label “PROC_ERR” is defined. For consistency, use the same label name in every procedure.
Error Handler
This section is where the code goes if an error occurs in the procedure:
PROC_ERR: MsgBox "Error: (" & Err.Number & ") " & Err.Description, vbCritical
Here you can manage the error and determine what to do next. Examine the error object (Err) to see what occurred. For instance, Err.Number is the error number, Err.Description is the error description, etc.
If you add this to your code, you will able to see what type of error was happens.
Upvotes: 1