|
Sub piliang()
Dim iend As Long, k As Integer
Dim ir As Long, ic As Long
Dim arr, brr(), i
Dim iyear, imonth
iend = Range("c" & Rows.Count).End(3).Row
arr = Range("b2:d" & iend)
ReDim brr(1 To UBound(arr))
Range("g2:r3000").ClearContents
For ic = 7 To 18
For ir = 1 To UBound(arr)
If arr(ir, 3) = "在职" Then
If Month(arr(ir, 2)) & "月份" <= Cells(1, ic) Then
k = k + 1
brr(k) = arr(ir, 1)
End If
ElseIf Year(arr(ir, 3)) > "2011" And Month(arr(ir, 3)) & "月份" > Cells(1, ic) Then
If Year(arr(ir, 2)) = "2011" Then
k = k + 1
brr(k) = arr(ir, 1)
ElseIf Year(arr(ir, 2)) = "2012" And Month(arr(ir, 2)) & "月份" = Cells(1, ic) Then
k = k + 1
brr(k) = arr(ir, 1)
End If
End If
Next ir
Cells(2, ic).Resize(UBound(brr), 1) = Application.Transpose(brr)
k = 0
Next ic
End Sub
弄日期太 难了,等老师讲解。 |
|