Sub shishi()
Dim brr()
arr = Sheets("sheet1").Range("a1").CurrentRegion
sy = Sheets("sheet2").Range("a2").Value
For i = 2 To UBound(arr)
If (arr(i, 3) = "女" And sy - Split(arr(i, 7), "-")(0) = 55) Or _
(arr(i, 3) = "男" And sy - Split(arr(i, 7), "-")(0) = 60) Then
m = m + 1
ReDim Preserve brr(1 To m)
tx = sy & "-" & Split(arr(i, 7), "-")(1) & "-" & Split(arr(i, 7), "-")(2)
brr(m) = Array(arr(i, 2), arr(i, 3), arr(i, 6), arr(i, 8), arr(i, 12), tx)
End If
Next
With Sheets("sheet2")
.Range("a4:f10000").ClearContents
.Columns("a:f").NumberFormatLocal = "@"
.Range("a4").Resize(m, 6) = Application.Rept(brr, 1)
End With
End Sub |