|
查询按钮代码如下:- Private Sub CommandButton1_Click()
- ListView1.ListItems.Clear '清除
- ListView2.ListItems.Clear '
-
- With Sheets("sheet1")
- For i = 2 To .[F65536].End(xlUp).Row
- If InStr(.Cells(i, 8) & " ", "主") > 0 Then
- Set Itm = ListView1.ListItems.Add()
- qq = ListView1.ListItems.Count
- Itm.Text = qq
- Itm.SubItems(1) = qq
- Itm.SubItems(2) = .Cells(i, 1)
- Itm.SubItems(3) = .Cells(i, 2)
- Itm.SubItems(4) = .Cells(i, 3)
- Itm.SubItems(5) = .Cells(i, 4)
- Itm.SubItems(6) = Application.WorksheetFunction.SumIfs(.Columns("E:E"), .Columns("h:h"), "副", .Columns("F:F"), .Cells(i, 6)) * -1
- Itm.SubItems(7) = .Cells(i, 6)
- Itm.SubItems(8) = .Cells(i, 7)
- Itm.SubItems(9) = .Cells(i, 8)
- End If
- Next i
- End With
- Call CommandButton3_Click
- End Sub
复制代码 |
|