title: How to add a Data validation for a cell in excel using Spreadsheetgear - C# .NET
body: <p>I would like to add a data validation for a cell in an excel to allow ONLY numeric values.</p>
  
  <p>My code does the following, </p>
  
  <pre><code>SpreadSheetGearHelper hlpr = new SpreadSheetGearHelper(excelFilePath);
  cells = workbook.Worksheets[0].Cells;
  hlpr.WorkSheet(0).Cells[string.Format("{0}:{0}", colName)].Validation.Add(SpreadsheetGear.ValidationType.WholeNumber, ValidationAlertStyle.Stop,
  ValidationOperator.Between, "-9999999", "9999999");
  hlpr.WorkSheet(0).Cells[string.Format("{0}:{0}", colName)].NumberFormat = "@";
  hlpr.WorkSheet(0).Cells[string.Format("{0}:{0}", colName)].Validation.ErrorMessage = "Please enter a number";
  </code></pre>
  
  <p>But when I enter valid number within the range in excel it still says "Please enter a number".</p>
  
  <p>Can someone please help me out with this</p>