Userform组合框,显示相同的初始值 [英] Userform Combo Box that displays same initial value

查看:54
本文介绍了Userform组合框,显示相同的初始值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友


我有一个用户表单,我在其中使用了一个组合框 从电子表格中的列表中获取值。问题是,当我关闭表单并移动到程序的其他部分并稍后返回时,它会记住我以前的选择。我希望
显示相同的初始值而不记得我之前的选择。


以下是我尝试使用的代码:


< pre class ="prettyprint"> Private Sub UserFormHome_Activate()
Set ComboBoxShona.Value = Worksheets(" Data")。Range(" B2")。Value
End Sub


Private Sub ComboBoxShona_Change()
Select Case ComboBoxShona.Value
Case" Shona"
Case" English"
卸载我
UserFormHomeEnglish.Show

结束选择
结束子

其中" B2"包含值"Shona",这就是我希望组合框始终首先显示的内容。



非常感谢您的帮助。



LWS


解决方案



编辑...

路径分歧,我拿了一个少走过的路


Dear Friends

I have a userform in which I am using a combo box  that takes values from a list on a spreadsheet. The problem is that when I close the form and move to other sections of the program and later return it remembers my former selection. I would like it to display the same initial value and not remember my previous choice.

Below is the code I have tried using:

Private Sub UserFormHome_Activate()
        Set ComboBoxShona.Value = Worksheets("Data").Range("B2").Value
End Sub


Private Sub ComboBoxShona_Change()
     Select Case ComboBoxShona.Value
        Case "Shona"
        Case "English"
            Unload Me
            UserFormHomeEnglish.Show
            
    End Select
End Sub

where "B2" contains the value "Shona", which is what I want the combo box to display first at all times.

Your help is greatly appreciated.

LWS

解决方案


Edit...
the path diverged and I took the one less traveled


这篇关于Userform组合框,显示相同的初始值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆