excel VBA LISTBOX初始化代码

来源:互联网 时间:2016-01-03

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

相关阅读:
Top