Reputation: 71
I have a quite simple question - but I don't get any further with it.
I want to provide suggestions in my via Validation generated DropDown-List - but also let the user the freedom to edit to DropDown-List without any Error.
This is my Code:
else if (SpaltenBeschreibung.Ueberschrift.Equals("Land"))
{
range.Validation.Add(XlDVType.xlValidateList, Type.Missing, Type.Missing, String.Join(";", ListeLaender.ToArray()), Type.Missing);
range.Validation.IgnoreBlank = true;
range.Validation.InCellDropdown = true;
continue;
}
I tried and googled a lot - but i don't get the right settings to allow user edit and also show the "Liste.Laender"-List in the DropDown.
Any suggestions?
Here is a discription of whatI want, but with the wrong code... http://www.clear-lines.com/blog/post/Excel-In-Cell-DropDown-with-CSharp.aspx
"Error Alert defines the message that should show up when an invalid value is entered – and allows to disable the Error Alert if need be. So if all you wanted was a DropDown with “suggested” choices, you could just disable the error alert, and you would have a cell with a DropDown, where users could still type any freeform text they please."
That doesn't help me :(
Upvotes: 2
Views: 862
Reputation: 46
Add
range.Validation.ShowError = false
No errors are going to be shown regarding that cell, if you are sure that whats you want
Upvotes: 1
Reputation: 71
I solved this problem by Changing the xlAlertStyle to "Warning" or "Information" (i'm not quite sure and i don't have my sourcecode here to look it up). This allows it to change the cell even is the validation rules are on after a user prompt ;)
Upvotes: 0
Reputation: 96753
Consider using 3 cells:
Put the DV dropdown in cell A1.
Leave A2 empty.
In A3 enter:
=IF(A2="",A1,A2)
Thus if the user wants to override the DV, they enter a value in A2
Upvotes: 0