|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub test()
Set d = CreateObject("scripting.dictionary")
Dim Mypath, Myname As String
Dim wb As Workbook
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
With Sheets("Sheet1")
r = .Cells(.Rows.Count, 5).End(3).Row
For i = 7 To r
d(.Cells(i, 5).Value) = i
Next
End With
Mypath = ThisWorkbook.Path & "\"
Myname = Dir(Mypath & Myname)
Do While Myname <> ""
If ThisWorkbook.Name <> Myname Then
Set wb = GetObject(Mypath & Myname)
With wb.Sheets(1)
brr = .Range("F6").CurrentRegion.Resize(, 15)
For i = 2 To UBound(brr)
If d.exists(brr(i, 2)) Then
For j = 10 To 15
求和 = brr(i, j) + 求和
Next
ws.Cells(d(brr(i, 2)), 15) = 求和
求和 = 0
End If
Next
End With
End If
Myname = Dir
Loop
End Sub
|
|