问题
I have added the UDF in my excel template(C#) using excel addin classlibrary,but i can not use that function in custom validation when i use the UDF in custom validation of excel(data->validation->dropdownlist(custom))i get an error as:
You can not use references to other worksheeta or workbooks for data validation criteria.
Is there any solution to this problem? Can we use UDF in custom validation of excel?
回答1:
I had forgotten about the UDF-in-data validation restriction. I think that restriction has been removed in Excel 2010. Otherwise AFAIK the only way round it is to wrap the UDF in a Defined Name in the xlt (create a Defined Name in the xlt that references the UDF: NameValidate=MyUDF())
来源:https://stackoverflow.com/questions/4647693/can-we-use-udf-in-excel-custom-validation