title: C# excel data validation drop down list throwserror
body: <p>I'm trying to add drop down list to a range using c#.</p>
  <p>This is what I have done so far.</p>
  <pre><code> Worksheet ws = PPTAddIn.thisAddin2Obj.Application.ActiveWorkbook.ActiveSheet;
              ws.get_Range(&quot;a1&quot;).Validation.Delete();
              ws.get_Range(&quot;a1&quot;).Validation.InCellDropdown = true;
              ws.get_Range(&quot;a1&quot;).Validation.IgnoreBlank = true;
              ws.get_Range(&quot;a1&quot;).Validation.Add(XlDVType.xlValidateList, XlDVAlertStyle.xlValidAlertWarning, &quot;opt1,opt2,opt3&quot;, Missing.Value);
  </code></pre>
  <p>at 3rd line of code it throws below exception <br/>
  Exception from HRESULT: 0x800A03EC</p>
  <p><a href="https://i.stack.imgur.com/Jz8t3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jz8t3.png" alt="ErrorImage" /></a></p>
  <p>this is the stack trace <br/></p>
  <pre><code>   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp; msgData)    at Microsoft.Office.Interop.Excel.Validation.set_InCellDropdown(Boolean ) at MS.ProductionPlanningTool.Excel.Ribbon_PPT.ribbon_signin_Click(Object sender, RibbonControlEventArgs e) in D:\MidasCloud\CloudTFS\ProductionPlanning\MSP2\MS.ProductionPlanningTool.Excel\UI\Ribbon_PPT.cs:line 1328    at Microsoft.Office.Tools.Ribbon.RibbonPropertyStorage.ControlActionRaise(IRibbonControl control)    at Microsoft.Office.Tools.Ribbon.RibbonPropertyStorage.ButtonClickCallback(RibbonComponentImpl component, Object[] args)    at Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.Invoke(RibbonComponentCallback callback, Object[] args)    at Microsoft.Office.Tools.Ribbon.RibbonMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)    at Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.System.Reflection.IReflect.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
  </code></pre>