|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下。。。
仅供参考,供楼主测试。。。
Sub test()
Set d = CreateObject("scripting.dictionary")
Set dic = CreateObject("scripting.dictionary")
With Sheet1
arr = .Range(.[a4], .Cells(.Cells(Rows.Count, 2).End(3).Row, "m"))
brr = .Range("o4:w" & .Cells(6, "o").End(4).Row)
brr(1, 8) = "培优班"
End With
For i = 2 To UBound(arr)
If arr(i, 2) = Empty Then arr(i, 2) = arr(i - 1, 2)
Next
For i = 2 To UBound(arr, 2)
If arr(1, i) = Empty Then arr(1, i) = arr(1, i - 1)
Next
For i = 3 To UBound(brr)
d(brr(i, 1)) = i
Next
For i = 2 To UBound(brr, 2)
If brr(1, i) <> Empty Then dic(brr(1, i)) = i Else dic("管 理") = 3
Next
ReDim crr(1 To UBound(brr) - 2, 1 To 8)
For i = 3 To UBound(arr)
For j = 3 To UBound(arr, 2)
s = arr(i, j)
If d.exists(s) Then
If arr(i, 2) = "下午延时服务" Then
If dic.exists(arr(1, j)) Then
crr(d(s) - 2, dic(arr(1, j)) - 1) = crr(d(s) - 2, dic(arr(1, j)) - 1) + 1
Else
crr(d(s) - 2, 1) = crr(d(s) - 2, 1) + 1
End If
ElseIf arr(i, 2) = "晚3" Then
crr(d(s) - 2, 4) = crr(d(s) - 2, 4) + 1
Else
crr(d(s) - 2, 3) = crr(d(s) - 2, 3) + 1
End If
crr(d(s) - 2, 8) = "=sum(rc[-7]:rc[-1])"
End If
Next
Next
Sheet1.[p6:w39] = Empty
Sheet1.[p6].Resize(UBound(crr), 8) = crr
Set d = Nothing
Set dic = Nothing
Beep
End Sub
|
评分
-
3
查看全部评分
-
|