|
- 'Option Explicit
- Sub 多条件查询()
- Dim i As Long, j As Long, SL As Long
- Dim HuoZhu As String
- SL = 1
- With Sheets("汇总查询")
- i = .Range("a65536").End(xlUp).Row
- If i > 2 Then .Range("A3:G" & i).ClearContents
- HuoZhu = .Cells(1, 2)
- End With
- With Sheets("明细表")
- i = .Range("a65536").End(xlUp).Row
- barr = .Range("A1:G" & i)
- End With
- ReDim carr(1 To i, 1 To UBound(barr, 2))
- Stop
- For i = 1 To UBound(barr)
- If barr(i, 2) = HuoZhu Then
- For j = 1 To UBound(barr, 2)
- carr(SL, j) = barr(i, j)
- Next j
- SL = SL + 1
- End If
- Next i
- Sheets("汇总查询").Cells(3, 1).Resize(SL, UBound(barr, 2)) = carr
- MsgBox "查询完成!"
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|