|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
不包含本工作簿名,请测试:
Sub Macro1()
Dim arr(), myPath$, myFile$, m As Integer
Application.ScreenUpdating = False
myPath = ThisWorkbook.Path & "\"
myFile = Dir(myPath & "*.xls")
Do While myFile <> ""
If myFile <> ThisWorkbook.Name Then
m = m + 1
ReDim Preserve arr(1 To 2, 1 To m)
arr(1, m) = m
arr(2, m) = Split(myFile, ".")(0)
End If
myFile = Dir
Loop
ActiveSheet.UsedRange.Offset(1, 0).ClearContents
[a2].Resize(m, 2) = WorksheetFunction.Transpose(arr)
Application.ScreenUpdating = True
End Sub |
|