参与一下。。。
- Sub ykcbf() '//2024.9.1
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("编制")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 5)
- End With
- For i = 6 To UBound(arr)
- s = arr(i, 2)
- d(s) = Array(arr(i, 3), arr(i, 4), arr(i, 5))
- Next
- With Sheets("信息")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 9)
- End With
- ReDim brr(1 To r, 1 To 14)
- For i = 7 To UBound(arr)
- If arr(i, 9) = "副校级" Then
- m = m + 1
- brr(m, 1) = m
- brr(m, 2) = arr(i, 2)
- s = brr(m, 2)
- brr(m, 3) = d(s)(0)
- brr(m, 4) = d(s)(1)
- brr(m, 5) = d(s)(2)
- brr(m, 6) = arr(i, 3)
- If arr(i, 3) = "超设" Then
- brr(m, 6) = arr(i, 8)
- brr(m, 7) = arr(i, 3)
- End If
- If arr(i, 3) = "其他" Then
- brr(m, 6) = ""
- brr(m, 7) = arr(i, 3)
- End If
- brr(m, 8) = arr(i, 4)
- sfz = CStr(arr(i, 5))
- gender = Int(Mid(sfz, 17, 1))
- brr(m, 9) = IIf(gender = 1, "男", "女")
- brr(m, 10) = DateSerial(Mid(sfz, 7, 4), Mid(sfz, 11, 2), Mid(sfz, 13, 2))
- brr(m, 11) = DateDiff("yyyy", brr(m, 10), Date)
- brr(m, 12) = arr(i, 7)
- brr(m, 13) = arr(i, 8)
- End If
- Next
- With Sheets("提取")
- .[a6:n1000].Clear
- .Columns(5).WrapText = True
- With .[a6].Resize(m, 14)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- zr = Array(3, 4, 5)
- hb 6, 2, 3, zr
- End With
- End Sub
复制代码
|