|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub aa() '按一级部门提最大工号
rw = Sheet1.Cells(Rows.Count, 1).End(3).Row
yjbm = Sheet1.Range("d2")
If yjbm = "" Then
MsgBox "请填写一级部门"
Exit Sub
End If
gh = 0
For i = 5 To rw
If Sheet1.Cells(i, 4) = yjbm Then
If Int(Sheet1.Cells(i, 1)) > gh Then
gh = Int(Sheet1.Cells(i, 1))
End If
End If
Next
Sheet1.Cells(2, 1) = gh + 1
End Sub
Sub bb() '前三后三
rw = Sheet2.Cells(Rows.Count, 1).End(3).Row
ar = Sheet2.Range("a3:c" & rw)
ReDim br(1 To UBound(ar))
For i = 1 To UBound(ar)
a = ar(i, 3)
br(a) = br(a) & "," & i
Next
For j = 3 To 1 Step -1
b = Split(br(j), ",")
For k = 1 To UBound(b)
n = n + 1
Sheet2.Cells(n + 9, 5) = ar(Int(b(k)), 1)
Sheet2.Cells(n + 9, 6) = ar(Int(b(k)), 2)
Sheet2.Cells(n + 9, 7) = ar(Int(b(k)), 3)
Next
Next
r = 0: s = 0: n = 0
While r < 3
t = UBound(br) - s
If br(t) <> "" Then
b = Split(br(t), ",")
For k = 1 To UBound(b)
n = n + 1
Sheet2.Cells(n + 9, 9) = ar(Int(b(k)), 1)
Sheet2.Cells(n + 9, 10) = ar(Int(b(k)), 2)
Sheet2.Cells(n + 9, 11) = ar(Int(b(k)), 3)
Next
r = r + 1
End If
s = s + 1
Wend
End Sub
|
评分
-
1
查看全部评分
-
|