Here is a simple example of Filtering ListObjects using Excel AutoFilter function. This example uses the following spreadsheet
The following C# code will filter 'Apple' and 'Orange' using an Array
private void ExcelFilterExample() { String[] FilterList = {"Apple","Orange"}; Excel.Workbook oWB = Globals.ThisAddIn.Application.Workbooks.Open(@"C:\Users\comp\Documents\FreshFruitsnVegetables.xls"); Excel.Worksheet oWS = oWB.Worksheets[1]; oWS.ListObjects.AddEx (Excel.XlListObjectSourceType.xlSrcRange, oWS.UsedRange, System.Type.Missing ,Excel.XlYesNoGuess.xlYes).Name = "FruitList"; oWS.ListObjects["FruitList"].Range.AutoFilter(2, FilterList, Excel.XlAutoFilterOperator.xlFilterValues ); }





















