|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub qs()
- Dim arr, i, dic
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheet2.UsedRange.Value
- For i = 2 To UBound(arr)
- Z = (Day(CDate(arr(i, 1))) - 0.9) / 7
- Z = Application.WorksheetFunction.RoundUp(Z, 0)
-
- s = arr(i, 4) & "|" & arr(i, 6) & "|" & Z
- If Not dic.exists(s) Then
- dic(s) = arr(i, 11)
- Else
- dic(s) = dic(s) + arr(i, 11)
- End If
- Next
- brr = Sheet1.Range("b2:ak" & Sheet1.Cells(Rows.Count, 2).End(3).Row)
- For i = 1 To UBound(brr)
- s = brr(i, 1) & "|" & brr(i, 4)
- If dic.exists(s & "|" & "1") Then brr(i, 26) = dic(s & "|" & "1")
- If dic.exists(s & "|" & "2") Then brr(i, 31) = dic(s & "|" & "2")
- If dic.exists(s & "|" & "3") Then brr(i, 36) = dic(s & "|" & "3")
- Next
- Sheet1.Range("b2").Resize(UBound(brr), UBound(brr, 2)) = brr
- Set dic = Nothing
- End Sub
复制代码 |
|