|
楼主 |
发表于 2023-3-3 20:59
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub 显示()
Rem 显示到ListView1
Dim Item As ListItem, k
ListView1.ListItems.Clear
' Item.Tag = SelRow '用Tag属性记录工作表对应的行号
With shtWJk
For i = 6 To .Range("A65536").End(xlUp).Row
Set Item = ListView1.ListItems.Add(1)
If .Cells(i, 23) = "是" Then
Item.ForeColor = vbRed '颜色
Item.Bold = True '加粗
' For x = 2 To ListView1.ColumnHeaders.Count - 1
'' Item.ListSubItems(x).ForeColor = vbRed
'' Item.ListSubItems(x).Bold = True
'
'Next
'
For j = 1 To ListView1.ColumnHeaders.Count - 1
ListView1.ListItems(ListView1.ListItems.Count).ListSubItems(j).ForeColor = vbRed ' RGB(&HFF, 0, 0)
Next j
End If
Item.Text = .Cells(i, 1)
Item.SubItems(1) = .Cells(i, 2)
Item.SubItems(2) = .Cells(i, 3)
Item.SubItems(3) = .Cells(i, 4)
Item.SubItems(4) = .Cells(i, 5)
Item.SubItems(5) = .Cells(i, 6)
Item.SubItems(6) = .Cells(i, 7)
Item.SubItems(7) = .Cells(i, 8)
Item.SubItems(8) = .Cells(i, 9)
Item.SubItems(9) = .Cells(i, 10)
Item.SubItems(10) = .Cells(i, 11)
Item.SubItems(11) = .Cells(i, 12)
Item.SubItems(12) = .Cells(i, 13)
Item.SubItems(13) = .Cells(i, 14)
Item.SubItems(14) = .Cells(i, 15)
Item.SubItems(15) = .Cells(i, 16)
Item.SubItems(16) = .Cells(i, 17)
Item.SubItems(17) = .Cells(i, 18)
Item.SubItems(18) = .Cells(i, 19)
Item.SubItems(19) = .Cells(i, 20)
Item.SubItems(20) = .Cells(i, 21)
Item.SubItems(21) = .Cells(i, 22)
Item.SubItems(22) = .Cells(i, 23)
Item.SubItems(23) = .Cells(i, 24)
Item.SubItems(24) = .Cells(i, 25)
Item.SubItems(25) = .Cells(i, 26)
Item.SubItems(26) = .Cells(i, 27)
Item.SubItems(27) = .Cells(i, 28)
Item.SubItems(28) = .Cells(i, 29)
Next
End With
' With ListView1
' For i = 21 To .ListItems.Count
' If .ListItems(i).Text Like "*是*" Then
' .ListItems(i).ForeColor = RGB(255, 0, 0)
' End If
' Next
'End With
Label27.Caption = "在 " & shtWJk.Range("A65536").End(3).Row - 5 & _
" 条记录中找到 " & ListView1.ListItems.Count & " 个。"
Call 新建_Click
End Sub
|
|