|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下。。。
- Sub ykcbf() '//2024.5.17
- Dim fns As New Collection
- With Application.FileDialog(msoFileDialogFolderPicker)
- .Title = "请选择文件夹"
- .InitialFileName = ThisWorkbook.Path & ""
- If .Show = -1 Then
- p = .SelectedItems(1) & ""
- End If
- End With
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set sh = ThisWorkbook.Sheets("操作台")
- Set ff = fso.GetFolder(p)
- getFiles ff, fns, fso
- ReDim brr(1 To 1000, 1 To 1)
- For Each f In fns
- m = m + 1
- brr(m, 1) = f(1)
- Next
- With sh
- .[h2:h1000] = ""
- .[h2].Resize(m, 1) = brr
- End With
- MsgBox "OK!"
- End Sub
复制代码
|
|