|
本帖最后由 wangzan 于 2012-12-14 16:52 编辑
Public Sub 分类()
Dim arr, ye1 As Integer, ye2 As Integer, m1 As Integer, m2 As Integer, x As Integer, y As Integer, h As Integer, h1 As Integer
h = Range("A" & Rows.Count).End(3).Row
arr = Range("B1:D" & h)
For x = 2 To h
ye1 = Year(arr(x, 2))
m1 = Month(arr(x, 2))
If IsDate(arr(x, 3)) Then
ye2 = Year(arr(x, 3))
m2 = Month(arr(x, 3))
End If
If arr(x, 3) = "在职" Then
For y = m1 + 6 To 18
h1 = Cells(65536, y).End(3).Row
Cells(h1 + 1, y) = arr(x, 1)
Next
ElseIf ye2 = 2012 And ye1 = 2012 and m1<>m2 Then
For y = m1 + 6 To m2 -1 + 6
h1 = Cells(65536, y).End(3).Row
Cells(h1 + 1, y) = arr(x, 1)
Next
ElseIf ye2 = 2012 And ye1 < 2012 Then
For y = 7 To m2 + 6
h1 = Cells(65536, y).End(3).Row
Cells(h1 + 1, y) = arr(x, 1)
Next
End If
Next
End Sub
【函初201203班】-F16-wangzan
公式不会写
|
评分
-
查看全部评分
|