title: How to add number validation in MS Excel cell using C#
body: <p>My objective is to restrict user to enter values only between the range of  1 to 100 in MS Excel cell.</p>
  
  <p>I am programmatically generating Excel files, but when I add above validation Exception is thrown as <code>Exception from HRESULT: 0x800A03EC</code></p>
  
  <p>code I've written is as below: </p>
  
  <pre><code>int[] arr = {1,100};
  ExcelApp.get_Range(col1, col2).Cells.Validation.Add(Microsoft.Office.Interop.Excel.XlDVType.xlValidateList, Microsoft.Office.Interop.Excel.XlDVAlertStyle.xlValidAlertInformation, Microsoft.Office.Interop.Excel.XlFormatConditionOperator.xlBetween, arr, Type.Missing);
  </code></pre>
  
  <p>In above code <code>ExcelApp</code> is an object of <code>Microsoft.Office.Interop.Excel.ApplicationClass</code> </p>
  
  <p>Any help is really appreciated.</p>