Sub chaxun()
Dim k, arr, brr, i
k = Sheet1.Range("a65536").End(xlUp).Row
arr = Sheet1.Range("a6:g" & k)
ReDim brr(1 To k - 5, 1 To 5)
Sheet2.Range("b6").Resize(10, 5) = ""
For i = 1 To k - 5
If Sheet2.Range("c3") = Sheet1.Range("d3") Then
If arr(i, 4) > 0 Then
m = m + 1
brr(m, 1) = arr(i, 1)
brr(m, 3) = arr(i, 2)
brr(m, 4) = arr(i, 3)
brr(m, 5) = arr(i, 4)
End If
End If
If Sheet2.Range("c3") = Sheet1.Range("e3") Then
If arr(i, 5) > 0 Then
m = m + 1
brr(m, 1) = arr(i, 1)
brr(m, 3) = arr(i, 2)
brr(m, 4) = arr(i, 3)
brr(m, 5) = arr(i, 5)
End If
End If
If Sheet2.Range("c3") = Sheet1.Range("F3") Then
If arr(i, 6) > 0 Then
m = m + 1
brr(m, 1) = arr(i, 1)
brr(m, 3) = arr(i, 2)
brr(m, 4) = arr(i, 3)
brr(m, 5) = arr(i, 6)
End If
End If
If Sheet2.Range("c3") = Sheet1.Range("G3") Then
If arr(i, 7) > 0 Then
m = m + 1
brr(m, 1) = arr(i, 1)
brr(m, 3) = arr(i, 2)
brr(m, 4) = arr(i, 3)
brr(m, 5) = arr(i, 7)
End If
End If
Next
On Error Resume Next
Sheet2.Range("b6").Resize(m, 5) = brr
End Sub
|