![](/img/trans.png)
[英]Excel-VBA - How to identify Target range (more than 1 cell) is deleted in a Worksheet_Change function?
[英]How to display a worksheet on a form in excel-vba
我正在尝试在表单上显示工作表,但直到现在我都没有成功。 该工作表包含15列和大约2000行。 有人能帮我吗?
建立一个带有列表框和一个按钮的表单。 然后将此代码放入表单模块。 该按钮应命名为CommandButton1,并且列表框应命名为ListBox1。
最后,在列表框控件上,将columncount更改为15。
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
' Activate the sheet that has the data you want displayed in the listbox
Sheet1.Activate
' Put the range of the data you want displayed.
' Here I used columns "A" to "O" and 2000 rows
ListBox1.RowSource = "A1:O2000"
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.