|
请测试- Sub Inquire()
- Dim arr()
- Dim crr(), SK$, m&
- Dim KEY$, i&, j&
- Dim CXYF As String, DJLX As String, CXDW As String
- With Sheet4
- If .Cells(2, 2) <> "" Then CXYF = .Cells(2, 2).Value Else CXYF = "*"
- If .Cells(2, 4) <> "" Then DJLX = .Cells(2, 4).Value Else DJLX = "*"
- If .Cells(2, 6) <> "" Then CXDW = .Cells(2, 6).Value Else CXDW = "*"
- arr = Sheet6.UsedRange 'Starting from 2
- ReDim crr(1 To UBound(arr), 1 To UBound(arr, 2))
- KEY = CXYF & "|" & DJLX & "|" & CXDW
- For i = 3 To UBound(arr)
- SK = Month(arr(i, 1)) & "|" & arr(i, 2) & "|" & arr(i, 4)
- If SK Like KEY Then
- m = m + 1
- For j = 1 To UBound(arr, 2)
- crr(m, j) = arr(i, j)
- Next j
- End If
- Next i
- .Cells(4, 1).Resize(UBound(crr), UBound(crr, 2)) = crr
- End With
- End Sub
复制代码 |
|