|
参与一下。。。
- Sub ykcbf() '//2024.6.17
- Set fso = CreateObject("scripting.filesystemobject")
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("合并总表")
- p = ThisWorkbook.Path & ""
- ReDim brr(1 To 1000, 1 To 9)
- For Each f In fso.GetFolder(p).Files
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- fn = fso.GetBaseName(f)
- m = m + 1
- brr(m, 1) = fn
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("建设项目结算汇总表")
- r = .Columns(3).Find("合计", LookAt:=xlWhole).Row
- For j = 7 To 14
- brr(m, j - 5) = .Cells(r, j)
- Next
- End With
- wb.Close False
- End If
- Next f
- With sh
- .UsedRange.Offset(1).Clear
- .[a1].Resize(1, 9).Interior.Color = 49407
- With .[a2].Resize(m, 9)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|