GManika
GManika

Reputation: 575

How to identify which cell(s)/column(s) have Filters set?

I am using Microsoft Interop to read the data.

In excel-sheet, multiple random columns have "filters" set. How do I find out which cells /columns have filters set? I would like lo load only the columns that have filters set.

here is how the sheet looks like

row 1-5, col 1-10 [long text describes the data in the sheet, i do not want to load ]

row 1-10, col 1 [some data, not filtered, i do not want to load]

row 1-10, col 2-15 [filter set for some columns only, i would like to detect the filters and load the entire column data ]

Upvotes: 4

Views: 5656

Answers (1)

phoog
phoog

Reputation: 43056

  • The Worksheet interface has an AutoFilter property that returns an AutoFilter interface.
  • The AutoFilter interface has a Filters property that returns a Filters interface.
  • The AutoFilter interface has a Range property that returns the range being filtered.
  • The Filters interface is a collection of Filters; these are in the same order as the columns in AutoFilter.Range
  • The Filter interface has an On property that indicates whether the column is being filtered.

Upvotes: 2

Related Questions