简体   繁体   English

Excel将下拉列表的所有数据提取到Column中

[英]Excel extract all data of drop down list into Column

I have copied a drop down list cell from other sheet and trying to fetch its all items name. 我已经从其他工作表中复制了一个下拉列表单元格,并试图获取其所有项目名称。 Dropdown list is created through excel property by this link, not using Combo Box . 下拉列表是通过excel属性通过链接创建的,而不是使用Combo Box Is there any way to get all items of drop down list ? 有什么方法可以获取下拉列表中的所有项目? Means get the original list which is mapped to the drop down. 均值获取映射到下拉列表的原始列表。

I tried to get it through VB Script also but it does not work. 我也尝试通过VB脚本来获取它,但是它不起作用。

Dim dd As DropDown
Set dd = ActiveSheet.DropDowns("MyDropDown")

When I debug that code it show "unable to get the dropdowns property of the worksheet class" error at 当我调试该代码时,它显示“无法获取工作表类的dropdowns属性”错误

Set dd = ActiveSheet.DropDowns("MyDropDown")

line and this Excel dropdowns in VBA: "Unable to get the DropDowns property of the Worksheet class" not helped me. 行和VBA中的Excel下拉列表:“无法获取Worksheet类的DropDowns属性”对我没有帮助。 Is ActiveSheet.DropDowns("MyDropDown") works only for Combo Box ? ActiveSheet.DropDowns(“ MyDropDown”)仅适用于组合框吗? Then how I get all items either using excel property or VB Script? 然后,如何使用excel属性或VB脚本获取所有项目?

Ah, your original question didn't make it clear that you were using Data Validation. 嗯,您最初的问题并不清楚您使用的是数据验证。 To loop through all the items in a Data Validation list, you can use this code: 要遍历数据验证列表中的所有项目,可以使用以下代码:

Sub loopthroughvalidationlist()
     Dim inputRange As Range
     Dim c As Range
     ' Change range below to first cell in your list
     Set inputRange = Evaluate(Range("J6").Validation.Formula1)
     For Each c In inputRange
        MsgBox (c)
     Next c
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从excel中的数据验证单元格中提取所有下拉值到每个值的单个单元格? - How to extract all drop down values from a data validated cell in excel to single cells for each value? ms excel-2下拉列表的数据验证 - ms excel - data validation for 2 drop down list 数据验证 - excel 中没有重复项的下拉列表 - Data validation - Drop down list with no duplicates in excel 在Excel中下拉列表 - Drop down list in Excel Excel 下拉列表 - Excel Drop Down List 使用VBA代码将Excel中的数据验证(下拉列表)分为整列 - Data Validation (Drop-Down List) in Excel into a whole column using VBA code Excel创建数据验证动态下拉列表的唯一项目,不包含新列 - Excel Create Data Validation Unique items for dynamic Drop Down List without new Column 如何将 excel 中的第一行放入下拉列表以过滤列数据? - How can I make the first row in excel into a drop down list to filter the column data? Excel 问题:当列表是列名并且我希望它显示该列下的所有行时,如何进行动态下拉? - Excel Question: How do I make a dynamic drop down when the list is the column name and I want it to show all the row under that column? 带有下拉列表的 VBA Excel 2013 列范围,用于创建 VBA 代码以选择所有和取消选择所有复选标记 - VBA Excel 2013 Column Range with Drop Down List to Create VBA Code to Select All & Deselect All Check Marks
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM