excel VBA LISTBOX初始化代码

来源:转载

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

分享给朋友:
您可能感兴趣的文章:
随机阅读: