简体   繁体   English

在工作表中下拉组合框,而不是在用户窗体上

[英]DropDown a ComboBox in a sheet, NOT on a UserForm

In an Excel sheet, NOT on a UserForm - Trying to come up with a code to be able to drop down a combo box, ie to get it to open.在 Excel 工作表中,而不是在用户窗体上 - 试图想出一个能够下拉组合框的代码,即打开它。 Might use it to trigger with hover over a shape.可以使用它来触发悬停在形状上。 But, get a "Compile error: Invalid use of Me keyword", and without "Me."但是,得到一个“编译错误:无效使用 Me 关键字”,并且没有“Me”。 get "Run-time error '424': Object required"得到“运行时错误'424':需要对象”

Sub ActivateCB1()
ActiveSheet.ComboBox1.Activate
Me.ComboBox1.DropDown
End Sub

Me only works in a code module attached to (eg) a worksheet or userform Me只在附加到(例如)工作表或用户表单的代码模块中工作

Sub ActivateCB1()
    With ActiveSheet.ComboBox1
        .Activate
        .DropDown
    End With
End Sub

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM