title: C# get column count and rows count for only valid range with interopExcel
body: <p>I am working with Micorsoft Office interop Excel
  Now my problem is when updated data cannot get correct rows and column count.</p>
  
  <pre><code>Excel.Application xlApp = new Excel.Application();
  Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(txtbTrainPath.Text);
  Excel.Worksheet xlWorksheet = xlWorkbook.Worksheets[1];
  Excel.Range xlRange = xlWorksheet.UsedRange;
  rowCount = xlRange.Rows.Count;
  colCount = xlRange.Columns.Count;   
  object[] cols = { 3 };
  xlRange.RemoveDuplicates(cols);
  rowCount = xlRange.Rows.Count;
  colCount = xlRange.Columns.Count;
  </code></pre>
  
  <p>Now, here I cannot get updated rows count. I want after removed duplicate rows, then want to get rows count. Can you help me with than?</p>