Reputation: 13
I need to delete a drop down box from an excel sheet. I've tried searching for the formula value, deleting the cell value, deleting it from the macro and nothing works. Any suggestions would be appreciated. The client would like this update today. Thanks!
Upvotes: 1
Views: 1173
Reputation: 1578
I tried this one. It works for me.
var cell = (Microsoft.Office.Interop.Excel.Range)oSheet.Cells[row, column];
cell.Validation.Delete();
cell.Validation.Add(
XlDVType.xlValidateInputOnly,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing);
cell.Value = "";
cell.Validation.IgnoreBlank = false;
cell.Validation.InCellDropdown = false;
Upvotes: 1
Reputation: 543
You might take a look at the Delete method of the Validation object -- e.g.,
Excel.Range range = wksht.get_Range("A1", "A1");
range.Validation.Delete();
Upvotes: 0