|
发表于 2014-11-7 19:45
|
显示全部楼层
本楼为最佳答案
- Private Sub CommandButton7_Click()
- ListView1.ListItems.Clear
- If TextBox1 & TextBox2 & TextBox3 & TextBox4 = "" Then
- MsgBox "请至少输入一个查询条件"
- Exit Sub
- End If
- With Sheets("数据库")
- For RowIndex = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
- If (.Cells(RowIndex, 1).Text Like "*" & TextBox1 & "*" Or TextBox1 = "") _
- And (.Cells(RowIndex, 2) Like TextBox2 + "*" Or TextBox2 = "") _
- And (.Cells(RowIndex, 3) Like UCase(TextBox3) + "*" Or TextBox3 = "") _
- And (.Cells(RowIndex, 4) Like TextBox4 + "*" Or TextBox4 = "") Then
- Set lst = ListView1.ListItems.Add(, , .Cells(RowIndex, 1))
- lst.SubItems(1) = .Cells(RowIndex, 2)
- lst.SubItems(2) = .Cells(RowIndex, 3)
- lst.SubItems(3) = .Cells(RowIndex, 4)
- lst.SubItems(4) = .Cells(RowIndex, 5)
- lst.SubItems(5) = .Cells(RowIndex, 6)
- lst.SubItems(6) = RowIndex
- End If
- Next
- End With
- End Sub
复制代码 |
评分
-
查看全部评分
|