excel VBA LISTBOX初始化代码
- 2023-03-03
- 来源/作者: Wps Office教程网/ 菜鸟图库
- 125 次浏览
Private Sub UserForm_Initialize()
Dim lsb As Worksheet
Set lsb = Sheets("临时表")
X = lsb.[a65536].End(3).Row
With ListBox1
.ColumnCount = 7 ‘设置7列
.ColumnWidths = "30,70,70,70,70,70,50" ‘设置每列宽度
.ColumnHeads = True ‘是否有标题表头
.RowSource = lsb.Range("a2:g" & X).Address(External:=True) ‘设置内容
End With
End Sub