|
- ''窗体初始化
- Private Sub UserForm_Initialize()
- Application.ScreenUpdating = False '关闭屏幕涮新,这样可以让程序运行得更快一些
- Dim arr, rw, a
- rw = Sheet12.Cells(Rows.Count, 2).End(xlUp).Row
- Dim r As Integer
- arr = Sheet12.Range("b3").Resize(rw, 25).Value
- With Me
- .Width = Application.Width - 20
- .Left = Application.Left + 10
- .Top = Application.Top + 6
- .ListView1.Width = Application.Width
- End With
-
- Application.WindowState = xlMaximized
- ' On Error Resume Next
- With Me.ListView1
- .ColumnHeaders.Clear
- .ColumnHeaders.Add , , "PO单号", 70, lvwColumnLeft
- .ColumnHeaders.Add , , "料号", 75, lvwColumnLeft
- .ColumnHeaders.Add , , "单位", 35, lvwColumnCenter
- .ColumnHeaders.Add , , "请购帐户", 50, lvwColumnCenter
- .ColumnHeaders.Add , , "采购员", 45, lvwColumnCenter
- .ColumnHeaders.Add , , "收货地点", 120, lvwColumnLeft
- .ColumnHeaders.Add , , "供应商", 160, lvwColumnLeft
- .ColumnHeaders.Add , , "供应商地址", 55, lvwColumnLeft
- .ColumnHeaders.Add , , "数量", 45, lvwColumnCenter
- .ColumnHeaders.Add , , "PO下单日期", 95, lvwColumnLeft
- .Width = Application.Width - 23 '全屏后-23
- .View = lvwReport '选择为报表格式
- .Gridlines = True '选择有网格线
- .FullRowSelect = True '允许选中整行
- ' .SmallIcons = ImageList1 '改变行行距
- Dim itm As ListItem
- a = [{6,8,23,4,13,5,25,15,9}]
- For i = 1 To UBound(arr)
- Set itm = .ListItems.Add()
- itm.Text = arr(i, 1)
- For j = 1 To UBound(a)
- itm.SubItems(j) = arr(i, a(j))
- Next
- Next
-
- End With
- Application.ScreenUpdating = True '关闭屏幕涮新
- End Sub
复制代码 |
|