|
Sub 筛选()
Dim ar As Variant
Dim br()
With Sheets("在职")
r = .Cells(Rows.Count, 4).End(xlUp).Row
ar = .Range("a1:an" & r)
End With
ReDim br(1 To UBound(ar), 1 To UBound(ar, 2) - 1)
For i = 2 To UBound(ar)
If Trim(ar(i, 12)) <> "" Then
If Trim(ar(i, 12)) = "辞职" Then
n = n + 1
For j = 2 To UBound(ar, 2)
br(n, j - 1) = ar(i, j)
Next j
End If
End If
Next i
If n = "" Then MsgBox "没有离职人员": End
With Sheets("sheet2")
.[a1].CurrentRegion.Offset(1) = Empty
.Cells(2, 1).Resize(n, UBound(br, 2)) = br
End With
MsgBox "ok!"
End Sub
|
|