Hi,
I have a C# application that writes data into Excel. I need to restrict one column to contain only numerical value.
In Excel, It should not allow the user to enter non-numerical values or should Prompt the user to enter only numerical values. I should achieve this functionality from C# when I load values to Excel itself. This condition must be stored in Excel and should apply even after disconnecting from C# application.
Regards,
Meena
netspiderPosted Mar 5, 2008, 4:40 PM
This can be acheived using Excel Range.Validation
Sample:
If I need to restrict the column to have only positive decimal values for column 4
((Excel.Range)xlWorksheet.Cells[3, 4]).EntireColumn.Validation.Add(Excel.XlDVType.xlValidateDecimal,Excel.XlDVAlertStyle.xlValidAlertStop, Excel.XlFormatConditionOperator.xlGreaterEqual, 0, 0);