感谢您在过去的所有帮助,感谢Excel中的各种VBA问题。经过一些研究和试验和错误,我被建议使用listview而不是列表框。到目前为止一切都那么好 - 得到了我想要的数据并且确实看起来更好......但是......我只能将所有列宽的宽度设置为一定的大小。理想情况下,要手动设置10列的宽度 - 或者可能是基于标题的自动调整大小。但我更愿意选择宽度。我将很快附上我的代码。
==============================
Private Sub LoadListView()
'Declare the variables
Dim wksSource As Worksheet
Dim rngData As Range
Dim rngCell As Range
Dim LstItem As ListItem
Dim RowCount As Long
Dim ColCount As Long
Dim i As Long
Dim j As Long
'Set the source worksheet
Set wksSource = Worksheets("Sheet1")
'Set the source range
Set rngData = wksSource.Range("A1").CurrentRegion
'Add the column headers
For Each rngCell In rngData.Rows(1).Cells
Me.ListView1.ColumnHeaders.Add Text:=rngCell.Value, Width:=53
Next rngCell
'Count the number of rows in the source range
RowCount = rngData.Rows.Count
'Count the number of columns in the source range
ColCount = rngData.Columns.Count
'Fill the ListView
For i = 2 To RowCount
Set LstItem = Me.ListView1.ListItems.Add(Text:=rngData(i, 1).Value)
For j = 2 To ColCount
LstItem.ListSubItems.Add Text:=rngData(i, j).Value
Next j
Next i
End Sub