title: How to get the row index after filtering data in Excel 2010 via C#
body: <p>I meet a problem:There are many data in an Excel sheet  and I need add comment in the specified rows by filter.</p>
  
  <p>Unfortunately,there is no unique column in the sheet except row index by default.The question is how to get the row index?Any help will be appreciated.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>    public static void FilterExcelByValue(string filePath, int columnIndex,string val)
      {
          Microsoft.Office.Interop.Excel.Application app = new
          Microsoft.Office.Interop.Excel.Application();
          app.Visible = true;
  
          Microsoft.Office.Interop.Excel.Workbook workBook = app.Workbooks.Open(filePath, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
          Microsoft.Office.Interop.Excel.Worksheet workSheet = (Microsoft.Office.Interop.Excel.Worksheet)workBook.ActiveSheet;
  
          Range range = (Microsoft.Office.Interop.Excel.Range)workSheet.UsedRange;
          range.Select();
          range.Activate();
          range.AutoFilter(columnIndex, val, Microsoft.Office.Interop.Excel.XlAutoFilterOperator.xlFilterValues, Type.Missing, true);
          Range visibleCells = range.SpecialCells(
                             Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeVisible,
                             Type.Missing);
          foreach (Range area in visibleCells.Areas)
          {
              foreach (Range row in area.Rows)
              {
                 //Add logic
  
              }
          }
  
  
      }
  </code></pre>
  
  <p>The filtered table like this below:<br>
  <br>
  <strong>Index &nbsp;&nbsp;&nbsp;&nbsp;Data<br>
  &nbsp;&nbsp;7   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  0310939<br>
  &nbsp;&nbsp;9   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  0311572<br>
  &nbsp;&nbsp;10  &nbsp;&nbsp;&nbsp;&nbsp;0312079<br>
  &nbsp;&nbsp;15  &nbsp;&nbsp;&nbsp;&nbsp;0312900<br>
  &nbsp;&nbsp;19  &nbsp;&nbsp;&nbsp;&nbsp;0313530</strong></p>