|
- Sub qq()
- Dim d, arr, p$, ws, r%, i%
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("Scripting.Dictionary")
- Cells.Clear
- Sheets("清单明细").Cells.Copy [a1]
- Columns("f").Insert
- p = ThisWorkbook.Path & "\任务表.xlsx"
- Set ws = Workbooks.Open(p)
- With ws.Sheets("任务")
- r = .Cells(.Rows.Count, 2).End(xlUp).Row
- arr = .Range("b5:f" & r)
- For i = 1 To UBound(arr)
- d(arr(i, 1)) = d(arr(i, 1)) & arr(i, 4) & "+" & arr(i, 5)
- Next
- ws.Close
- End With
- For i = 4 To [b65536].End(xlUp).Row
- If d.exists(Cells(i, 2).Value) Then
- Cells(i, 5) = Cells(i, 5).Value * Val(Split(d(Cells(i, 2).Value), "+")(0))
- Cells(i, 6) = Split(d(Cells(i, 2).Value), "+")(1)
- End If
- Next
- Columns("b").Delete
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|