组合框的默认值(表单控件)VBA [英] Default value of Combobox(form control) VBA
问题描述
<有人可以帮忙吗?这是我试图使用的
用ws(1).shapes(Chill1)。controlformat
。 listindex = 1
结束
默认组合框的状态将为空白,因此如果需要输入任何内容,通常是列表范围中的一个项目。
eg输入范围(属性)为
A1:A10
,单元格链接
B1
然后B1可以手动或通过宏(workbook_open事件)设置为值:1
Private Sub Workbook_Open()
工作表(Sheet1)。Range(B1)= 1
End Sub
,A1可以包含字符串选择类型
每当打开工作簿时,宏将这些列表的第一个值设置为选择类型
Hey I have been searching a lot on the internet but I haven't been able to find the solution. I have atleast 10-15 combobox(form control) in my workbook. I want them to display a default value of say "Select type". Now, I have tried doing this using the ".listindex" but then it doesn't allow me to change the value in the combobox(as the default is set permanently).
Can someone help? This is what I tried to use
With ws(1).shapes("Chill1").controlformat
.listindex = 1
End with
The default state of the Combobox would be blank, so if anything needs to be put in, it'll usually be an item from the list range.
e.g. the input range (from Properties) is
A1:A10
and the cell link is
B1
Then B1 can be manually or through a macro (workbook_open event) set to value: 1
Private Sub Workbook_Open()
Worksheets("Sheet1").Range("B1") = 1
End Sub
and A1 can contain the string 'Select Type'
That way everytime the workbook is opened, the macro sets the 1st values of each of these lists to "Select Type"
这篇关于组合框的默认值(表单控件)VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!