|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Private Sub UserForm_Initialize()
- Dim Arr, i&
- With ListView1.ColumnHeaders
- .Add , , "编码"
- .Add , , "物品名称", Width / 4
- .Add , , "规格型号", Width / 8, lvwColumnCenter
- .Add , , "单位", Width / 8, lvwColumnCenter
- .Add , , "设定单价", Width / 8
- .Add , , "二科目", Width / 8
- .Add , , "三科目", Width / 8
- .Add , , "供货商", Width / 8
- End With
- ListView1.View = lvwReport
- ListView1.Sorted = True
- ListView1.SortKey = 0
- ListView1.Gridlines = True
- ListView1.FullRowSelect = True
- Label2.Caption = ""
- Label3.Caption = ""
- Arr = Sheet1.[a1].CurrentRegion
- With Sheet1
- For i = 2 To UBound(Arr)
- Set ITM = ListView1.ListItems.Add()
- ITM.Text = Arr(i, 1)
- ITM.SubItems(1) = Arr(i, 2)
- ITM.SubItems(2) = Arr(i, 3)
- ITM.SubItems(3) = Arr(i, 4)
- ITM.SubItems(4) = Format(Arr(i, 5), "#,##0.00")
- ITM.SubItems(5) = Arr(i, 6)
- ITM.SubItems(6) = Arr(i, 7)
- ITM.SubItems(7) = Arr(i, 8)
- Next i
- End With
- Label2.Caption = "共找到 " & ListView1.ListItems.Count & " 条记录"
- TextBox1.SetFocus
- End Sub
复制代码 |
|