办公软件学习技巧:excel VBA基本操作:遍历当前文件夹下的excel文件

时间:2023-04-02 15:53:14 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。
excel VBA基本操作:遍历当前文件夹下的

excel文件

常常用到excel以下是遍历当前文件夹下的excel表。

Sub bl() Dim myPath As String, myFile As String Dim i As Integer Dim Arr() As String i 0 myPath ThisWorkbook.Path *.xls* myFile Dir(myPath) If myFile ThisWorkbook.Name Then 假如不是本文件取出放入数组2021228日修改 ReDim Preserve Ar(i) 不清空数组 Ar(i) myFile i i 1 End If Do While myFile myFile Dir If myFile Then Exit Do End If ReDim Preserve Ar(i) 不清空数组 Ar(i) myFile i

i 1 Loop MsgBox i excel文件 End sub

1


本文来源:https://www.wddqw.com/doc/fc3c28b0d3d233d4b14e852458fb770bf78a3bb0.html