EXCEL VBA 遍历所有文件夹和子文件夹的文件中指定单元格中的数据,汇总到一张工作表中,
Sub数据提取()d=TimerDimmypath$,myname$Dimarr,brr(1To1000,1To5)Application.ScreenUpdating=...
Sub 数据提取()d = TimerDim mypath$, myname$Dim arr, brr(1 To 1000, 1 To 5)Application.ScreenUpdating = Falsemypath = ThisWorkbook.Path & "\"myname = Dir(mypath & "*.xl*")Do While myname <> "" If myname <> ThisWorkbook.Name Then Set wb = GetObject(mypath & myname) With wb With .Worksheets("报告书") m = m + 1 For i = 1 To 5 brr(m, i) = .Cells(100, i) Next End With .Close False End With End If myname = Dir()LoopWith Worksheets("汇总") .[B3].Resize(m, 5) = brrEnd WithEnd Sub目前代码只能收集同目录下的文件信息,求人帮忙改一下,使得能遍历所有文件夹和子文件夹的文件
展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询