I generate some Excel file with Microsoft Interop, no problem, I can create files, sheet, file, password protect. But I’d like :
- for a specific range allow only numbers
- for an another specific range allow only numbers but only 0 or 1
Do you have an idea how to do this ?
Thanks,
took a while but I think I got it. I am assuming you’re using Excel 2007. I am also assuming you have a reference to a range already. Here is a quick example.
This will add a validation of number between 0 and 1 for a specific range in this case between A1 and A5.
You can also play with the Validation object further to create custom Error Messages etc.
Hope this helps.