运行excel后按住alt依次按f11,i,m
粘贴下面代码后做必要修改后按f5 即可在当前工作表中得到汇总结果.
Sub test()
c = Array(1, 3, 5, 7, 8)
p = "d:\汇总文件所在目录\" '根据实际修改 注意别遗漏最后的\
f = Dir(p & "*.xlsx")
Set ns = ActiveSheet
Do Until f = ""
Set wb = Workbooks.Open(p & f)
For i = 0 To 4
n = n + 1
ns.Cells(2, n).Resize(144).Value = wb.Sheets("1号房间").Cells(2, c).Resize(144).Value
Next
wb.Close False
f = Dir
Loop
End Sub