Interrogating the Excel VBA 'Filters' object
-
I need to interrogate the Filters object to learn what columns have active filters (Filter.On = True) and what the filter criteria are for each filter.
The problem that I have encountered is that the Filters object does not contain any information about which column each Filters.Item relates to.
There is no real problem if all columns have been ‘enabled’ for filters (i.e. each column header cell has a down-pointing arrow), because Filters.Count = the number of columns in the worksheet, and I can easily associate each filter with its relevant column.
But when some (but not all) columns have been ‘enabled’ for filters (for example columns 4-8), I have not been able to discover an algorithm for correlating each of the 5 filters with its relevant column.
Can the hive mind I know and love as Code Project please help me. -
I need to interrogate the Filters object to learn what columns have active filters (Filter.On = True) and what the filter criteria are for each filter.
The problem that I have encountered is that the Filters object does not contain any information about which column each Filters.Item relates to.
There is no real problem if all columns have been ‘enabled’ for filters (i.e. each column header cell has a down-pointing arrow), because Filters.Count = the number of columns in the worksheet, and I can easily associate each filter with its relevant column.
But when some (but not all) columns have been ‘enabled’ for filters (for example columns 4-8), I have not been able to discover an algorithm for correlating each of the 5 filters with its relevant column.
Can the hive mind I know and love as Code Project please help me.You've posted this in the forum dedicated to questions about writing articles for CodeProject, which is not the correct place. Either post your question in the Visual Basic forum[^], or in Quick Answers[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer