本文介绍了如何设置ListBox1.RowSource属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一本有16张纸的Excel工作簿.
I have an Excel workbook with 16 sheets.
我希望在用户表单上有一个列表框,该列表框将列出工作表1单元格F2至F50中的数据.
I want a listbox on my userform which will list the data in Sheet 1 Cells F2 to F50.
我的代码
Private Sub UserForm_Initialize()
ListBox1.Clear
Sheet11.Activate
ListBox1.RowSource = "Sheet11!F2:F10"
End Sub
返回错误
推荐答案
要引用工作表名称,假设您的工作表名为Sheet1
...
To refer to the sheet name, assuming your sheet is named Sheet1
...
ListBox1.RowSource = "'Sheet1'!F2:F10"
要引用工作表的代号,假设Sheet11
是代号...
To refer the code name for the sheet, assuming that Sheet11
is the code name...
ListBox1.RowSource = "'" & Sheet11.Name & "'!F2:F10"
这篇关于如何设置ListBox1.RowSource属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!