Option
Explicit
Sub
Test()
Dim
rng
As
Excel.Range
Dim
vntResult
As
Variant
Dim
vntVal
As
Variant
With
Worksheets(
"Tabelle1"
)
Range(
"F2"
).Name =
"_search_cat"
Range(
"G2"
).Name =
"_search_sect"
For
Each
vntVal
In
Array(Array(
"A2"
,
"_section"
), Array(
"B2"
,
"_category"
), Array(
"C2"
,
"_notes"
))
With
.Range(vntVal(0), .Cells(.Rows.Count, .Range(vntVal(0)).Column).
End
(xlUp))
If
.Row < .Worksheet.Range(vntVal(0)).Row
Then
Call
MsgBox(
"Keine Daten in Spalte "
& .Range(vntVal(0)).EntireColumn.Address, vbExclamation)
Exit
Sub
End
If
.Name = vntVal(1)
End
With
Next
vntResult =
"=FILTER( _notes, "
& _
"ISNUMBER( MATCH( _search_cat, _category, 0) ) "
& _
"* ISNUMBER( MATCH( _search_sect, _section, 0) ) "
& _
")"
vntResult = .Evaluate(vntResult)
If
IsError(vntResult)
Then
Call
MsgBox(
"Wooops. :("
, vbCritical)
Else
Debug.Print
"[FILTER_ERGEBNIS]"
Debug.Print
"FILTER: {Bereich: '"
&
CStr
(.Range(
"_search_sect"
)) &
"'} {Kategorie: '"
&
CStr
(.Range(
"_search_cat"
)) &
"'}"
Debug.Print
String
(15,
"-"
)
For
Each
vntVal
In
vntResult
Debug.Print vntVal
Next
Debug.Print
String
(15,
"-"
)
End
If
End
With
End
Sub