|
Sub 筛选()
Dim ar As Variant
Dim arr()
Dim rng As Range
ReDim arr(1 To 50000, 1 To 24)
For Each sh In Sheets
If InStr(sh.Name, "客户") > 0 Then
m = m + 1
If m = 1 Then Set rng = sh.Rows("1:2")
rs = sh.Cells(Rows.Count, 12).End(xlUp).Row
ar = sh.Range("a1:x" & rs)
For i = 3 To UBound(ar)
If Trim(ar(i, 12)) <> "" Then
If IsDate(ar(i, 12)) Then
If Trim(ar(i, 23)) = "" Or IsDate(ar(i, 23)) Then
n = n + 1
For j = 1 To UBound(ar, 2)
arr(n, j) = ar(i, j)
Next j
End If
End If
End If
Next i
End If
Next sh
If n = "" Then MsgBox "没有符合条件的数据!": End
With Sheets("合并在库车辆")
.[a1].CurrentRegion = Empty
rng.Copy .[a1]
.[a3].Resize(n, UBound(arr, 2)) = arr
End With
MsgBox "ok!"
End Sub
|
|