1

Does anybody know how to filter a column of excel using the INTEROP C#, and filter all the values that contains 'ODM', or 'AAS'. I've already tried to use the namedRange.autofilter but it returns just those VALUES that is write ONLY 'ODM' or 'AAS' and nothing else.

PedroB
  • 47
  • 7

1 Answers1

0

This link seems to indicate Excel filters do not support regex. My own experience resonates with that. So, taking a step back, how can we solve your problem? Well, looking at what the VBA guys did, the idea seems to be as follows:

  • Read the entire column into an array: Interop lets you do this in one efficient swoop
  • Use C#'s powerful Regex engine to filter that array down to a set of values conforming to your regex
  • Call the Autofilter function with Criteria1 dynamically generated as the array you just created using the regex filter in the last step.

I'm not going to code that for you, but I'm quite certain the above approach will work and am happy to consult with you if you need assistance on it.

Colm Bhandal
  • 3,343
  • 2
  • 18
  • 29