|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。- Sub ykcbf() '//2024.8.9
- Set fso = CreateObject("scripting.filesystemobject")
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- ReDim brr(1 To 10000, 1 To 100)
- For Each f In fso.GetFolder(p).Files
- If LCase$(f.Name) Like "*.xls*" Then
- 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)
- For Each sht In wb.Sheets
- If InStr(UCase(sht.Name), "WX") Then
- With sht
- arr = .UsedRange
- wb.Close False
- End With
- End If
- Next
- For j = 1 To UBound(arr, 2)
- brr(m, j + 1) = arr(2, j)
- Next
- End If
- End If
- Next f
- With sh
- .[a3:az1000] = ""
- .[a3].Resize(m, 100) = brr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|