Combobox下拉菜单显示在其他表单中
我有一个combobox下拉searchbuild议,从这里的代码:
http://trumpexcel.com/2013/10/excel-drop-down-list-with-search-suggestions/
它工作得很好,但是当我在另一张纸上按下“Enter”时,search栏会随机地popup到表格中
它甚至不是整个盒子,只是蓝色的领域
任何关于禁用它的见解? 我得到的唯一成功是将计算转换为手动,但工作簿需要自动计算
谢谢!
我遇到了一个与我自己的VBA版本的智能search栏类似的问题。 我是如何解决这个问题的:
Private Sub ComboBox1_Change() If ComboBox1.Value = "" Then Exit Sub '<------ Problem solved. ComboBox1.ListFillRange = "DropDownList" Me.ComboBox1.DropDown End Sub
要么
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim SheetWithComboBox As Worksheet: Set SheetWithComboBox = ThisWorkbook.Sheets(1) If ThisWorkbook.ActiveSheet.Name <> SheetWithComboBox.Name Then ComboBox1.Visible = False Else: ComboBox1.Visible = True End If End Sub
@Tyeler
感谢您的帮助,您的想法帮助我想出一个办法
Private Sub ComboBox1_change() Dim sht1 As Worksheet Set sht1 = Worksheets("xxx") If ThisWorkbook.ActiveSheet.Name = sht1.Name Then ComboBox1.ListFillRange = "DropDownList" Me.ComboBox1.DropDown Call macro1 Else: Exit Sub End If End Sub
我发现一个解决scheme,至less对我来说,适用于所有的床单。
Private Sub Combobox_Get_Focus() ComboBox1.ListFillRange = "DropDownList" Me.ComboBox1.DropDown End Sub