|
根据你的表结构,设计了如下vba:若还有需求,联系我qq571563425
Sub 数据汇总()
Dim rng As Range, rng1 As Range, rng2 As Range, wb As Workbook
'关闭屏幕更新
Application.ScreenUpdating = False
'打开需要汇总表
Workbooks.Open ThisWorkbook.Path & "\路径\王一的路径\王一客户管理表.xlsm"
Workbooks.Open ThisWorkbook.Path & "\路径\蒋二的文件路径\蒋二客户管理表.xlsm"
Workbooks.Open ThisWorkbook.Path & "\路径\杨三的路径\杨三客户管理表.xlsm"
Workbooks.Open ThisWorkbook.Path & "\路径\赵四四的文件路径\赵四四客户管理表.xlsm"
ThisWorkbook.Activate
'获取C列汇总区域
Set rng = ThisWorkbook.Worksheets("客户").Range([c3], [c3].End(xlDown))
'循环汇总
For Each rng1 In rng
Set rng2 = Workbooks(rng1.Value & "客户管理表.xlsm").Worksheets("客户管理").[e:e].Find(rng1.Offset(0, 3))
rng2.Offset(0, -4).Resize(1, 52).Copy rng1.Offset(0, 50)
Next rng1
'关闭各个数据表
For Each wb In Workbooks
If wb.Name <> "汇总表.xlsm" Then wb.Close 0
Next wb
'恢复屏幕更新
Application.ScreenUpdating = True
'完成提示
MsgBox "汇总完成"
End Sub
|
|