|
公式保留。。。
- Sub ykcbf() '//2024.5.7
- Set fso = CreateObject("scripting.filesystemobject")
- Set d = CreateObject("Scripting.Dictionary")
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim tm: tm = Timer
- p = ThisWorkbook.Path & ""
- fs = p & "单价表.xlsx"
- Set wb = Workbooks.Open(fs, 0)
- With wb.Sheets("Sheet1")
- arr = .UsedRange
- wb.Close False
- End With
- For i = 2 To UBound(arr)
- d(arr(i, 2)) = arr(i, 6)
- Next
- p1 = p & "清单"
- For Each f In fso.GetFolder(p1).Files
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- fn = fso.GetBaseName(f)
- m = 0
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("Sheet1")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a4].Resize(r - 3, 10)
- ReDim brr(1 To UBound(arr), 1 To 2)
- For i = 2 To UBound(arr)
- s = arr(i, 2)
- m = m + 1
- If d.exists(s) Then
- brr(m, 1) = d(s)
- brr(m, 2) = arr(i, 8) * d(s)
- End If
- Next
- .[i5].Resize(m, 2) = brr
- End With
- wb.Close 1
- End If
- Next f
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "共用时:" & Format(Timer - tm) & "秒!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|