|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub qs()
Dim arr, i, s, dic
s = "书记、校长、专职副书记、副校长、工会主席"
Set dic = CreateObject("scripting.dictionary")
arr = Sheet1.Range("a7:i" & Sheet1.Cells(Rows.Count, 1).End(xlUp).Row)
ReDim brr(1 To 10000, 1 To 14)
ar = Sheet2.Range("b6:e" & Sheet2.Cells(Rows.Count, 2).End(3).Row).Value
For i = 1 To UBound(ar)
ss = ar(i, 1)
dic(ss) = Array(ar(i, 2), ar(i, 3), ar(i, 4))
Next
For i = 1 To UBound(arr)
If InStr(s, arr(i, 8)) Then
m = m + 1
brr(m, 1) = m
brr(m, 2) = arr(i, 2)
tt = dic(arr(i, 2))
brr(m, 3) = tt(0): brr(m, 4) = tt(1): brr(m, 5) = tt(2)
brr(m, 6) = VBA.Replace(arr(i, 3), "1名", "")
brr(m, 8) = arr(i, 4)
xx = Mid(arr(i, 5), 17, 1)
brr(m, 9) = IIf(Val(xx) Mod 2, "男", "女")
brr(m, 10) = VBA.DateSerial(Mid(arr(i, 5), 7, 4), Mid(arr(i, 5), 11, 2), Mid(arr(i, 5), 3, 2))
brr(m, 11) = DateDiff("yyyy", brr(m, 10), Date)
brr(m, 13) = arr(i, 8)
End If
Next
Sheet3.Range("a6").Resize(1000, 14).ClearContents
Sheet3.Range("a6").Resize(m, 14) = brr
Set dic = Nothing
End Sub
|
|