我有一个根路径,我有子目录。在每个子目录中都有一些我需要处理的文件。
我有当前的批处理脚本:
Option Explicit
Sub Demo()
Dim srcSht As Worksheet, destSht As Worksheet
Dim rowIndex As Long, colIndex As Long
Set srcSht = ThisWorkbook.Sheets("Sheet1") 'change Sheet1 to your source sheet
Set destSht = ThisWorkbook.Sheets("Sheet2") 'change Sheet1 to your output sheet
rowIndex = 1
colIndex = 28 'set col number for Column AB
With srcSht
Do While .Cells(8, colIndex).Value <> "" 'loop through column AB to last column with data in row 8
destSht.Cells(rowIndex, 1) = .Cells(8, colIndex) / .Cells(9, colIndex)
rowIndex = rowIndex + 5 'increment row by 5
colIndex = colIndex + 1 'increment column by 1
Loop
End With
End Sub
对于根路径中的每个子目录,回显文件名。
但是我注意到我的输出丢失了文件,并没有正确完成循环。
出了什么问题?
我是批处理脚本的新手,所以请原谅我的经验不足。