How to create dropdownlist on Excel 2003

瘦欲@ 提交于 2019-12-24 23:01:19

问题


I'm creating Excel files using AutomationFactory.CreateObject("Excel.Application").

I'm using these lines of codes to create a dropdown list:

mySheet.Range("A1").Validation.Add(Type:=Interop.Excel.XlDVType.xlValidateList, _
        AlertStyle:=Interop.Excel.XlDVAlertStyle.xlValidAlertStop, _
        [Operator]:=Interop.Excel.XlFormatConditionOperator.xlBetween,
                                            Formula1:="=List!$C$3:$C$903")

The formula (Formula1:="=List!$C$3:$C$903") returns 900 rows

In Excel 2010 it works perfectly, however, in Excel 2003 no dropdownlist are created on the cell

Any alternative ways?


回答1:


In order to create a dropdown list from another sheet in Excel, you have to create a named range and then declare the named range in the Validation formula.

See this tutorial on how to do it from scratch.



来源:https://stackoverflow.com/questions/7805207/how-to-create-dropdownlist-on-excel-2003

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!