首页 > Excel专区 > Excel函数 >

excel VBA LISTBOX初始化代码

Excel函数 2022-02-16 20:59:01

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


标签: 多个汉字表头设置excel函数

office教程网 Copyright © 2016-2020 http://www.office9.cn. Some Rights Reserved. 苏ICP备20040415号-9