【问题标题】:Excel VBA: Format Control dropdown populating unique values in cellsExcel VBA:格式控制下拉列表填充单元格中的唯一值
【发布时间】:2015-07-14 20:01:12
【问题描述】:
Private Sub Worksheet_Activate()

Dim levelDrop As Shape
Set levelDrop = Worksheets("Sheet1").Shapes("Drop Drown 7").ControlFormat

If levelDrop.ListIndex = 1 Then

Worksheets("Sheet1").Range("B31:B") = Worksheets("Control_Sheet").Range("I3:I213").RemoveDuplicates

End If

End Sub

我不知道问题是什么。我一直收到错误提示

“未找到具有指定名称的项目”。

错误指向的行是 Set 语句。怎么回事?

【问题讨论】:

    标签: vba excel drop-down-menu combobox


    【解决方案1】:

    您确定这是您的控件的正确名称吗:Drop Drown 7

    通常他们被命名为Dropdown 7

    【讨论】:

    • 在一行出现错误?你的下拉菜单叫什么名字?
    • 根据代码,下拉称为下拉7。错误在Set语句
    • 然后只需使用If Worksheets("Sheet1").Shapes("Drop Drown 7").ControlFormat.ListIndex = 1 Then
    • @Adit2789 如果对您有帮助,请随时将我的回答标记为您的解决方案
    猜你喜欢
    • 1970-01-01
    • 2020-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多