|
参与一下。。。
- Sub ykcbf() '//2024.6.15
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set Fso = CreateObject("Scripting.FileSystemObject")
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- ReDim brr(1 To 1000, 1 To 8)
- For Each f In Fso.GetFolder(p).Files
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- fn = Fso.GetBaseName(f)
- Set wb = Workbooks.Open(f, 0)
- m = m + 1
- brr(m, 1) = m
- With wb
- brr(m, 2) = .Sheets("基本信息").[c5].Value
- brr(m, 3) = .Sheets("基本信息").[c7].Value
- brr(m, 4) = .Sheets("基本信息").[c14].Value
- brr(m, 5) = .Sheets("同一品牌").[c3].Value
- brr(m, 6) = .Sheets("服务资本市场").[c4].Value
- brr(m, 7) = .Sheets("服务高质量发展").[c4].Value
- End With
- wb.Close False
- End If
- Next f
- With sh
- .UsedRange.Offset(2).Clear
- .[a3].Resize(m, 7) = brr
- .[a3].Resize(m + 1, 8).Borders.LineStyle = 1
- .Cells(m + 3, 1) = "合计": .Cells(m + 3, 1).Resize(1, 2).Merge
- For x = 1 To 5
- .Cells(m + 3, x + 2) = Application.Sum(.Cells(3, x + 2).Resize(m))
- Next
- End With
- Application.ScreenUpdating = True
- MsgBox "合并完毕!"
- End Sub
复制代码
|
评分
-
3
查看全部评分
-
|