|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 无主体分类统计()
Application.ScreenUpdating = False
Dim ar As Variant
Dim d As Object
Set d1 = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
Set d3 = CreateObject("scripting.dictionary")
Set d4 = CreateObject("scripting.dictionary")
With ActiveSheet
r = .Cells(Rows.Count, 1).End(xlUp).Row
If r < 2 Then MsgBox "数据源为空!": End
ar = .Range("a1:g" & r)
.Range("L4:O9,L12:O17,L19:O24,L27:O32") = Empty
br = .Range("k1:o32")
For i = 4 To 9
d1(br(i, 1)) = i
Next i
For i = 12 To 17
d2(br(i, 1)) = i
Next i
For i = 19 To 24
d3(br(i, 1)) = i
Next i
For i = 27 To 32
d4(br(i, 1)) = i
Next i
For i = 2 To UBound(ar)
If ar(i, 2) <> "" Then
If ar(i, 6) <> "" Then
xh = d1(ar(i, 2))
If xh <> "" Then
If ar(i, 6) <= 30 Then
br(xh, 2) = br(xh, 2) + 1
End If
If ar(i, 6) >= 31 And ar(i, 6) <= 40 Then
br(xh, 3) = br(xh, 3) + 1
End If
If ar(i, 6) >= 41 And ar(i, 6) <= 50 Then
br(xh, 4) = br(xh, 4) + 1
End If
If ar(i, 6) >= 51 Then
br(xh, 5) = br(xh, 5) + 1
End If
End If
End If
If ar(i, 5) <> "" Then
xh = d2(ar(i, 2))
If xh <> "" Then
If ar(i, 5) = "博士" Then
br(xh, 2) = br(xh, 2) + 1
ElseIf ar(i, 5) = "硕士" Then
br(xh, 3) = br(xh, 3) + 1
ElseIf ar(i, 5) = "本科" Then
br(xh, 4) = br(xh, 4) + 1
Else
br(xh, 5) = br(xh, 5) + 1
End If
End If
End If
If ar(i, 4) <> "" Then
xh = d3(ar(i, 2))
If xh <> "" Then
If ar(i, 4) = "全职" Then
br(xh, 2) = br(xh, 2) + 1
ElseIf ar(i, 4) = "实习" Or InStr(ar(i, 4), "外包") > 0 Then
br(xh, 3) = br(xh, 3) + 1
ElseIf ar(i, 4) = "临时聘用" Then
br(xh, 4) = br(xh, 4) + 1
End If
End If
End If
If ar(i, 3) <> "" Then
xh = d4(ar(i, 2))
If xh <> "" Then
If ar(i, 3) = "技术类" Then
br(xh, 2) = br(xh, 2) + 1
Else
br(xh, 4) = br(xh, 4) + 1
End If
End If
End If
End If
Next i
.Range("k1:o32") = br
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|