VBA统计文件夹下EXCEL文件中某一工作簿的数据
某一文件夹下有许多EXCEL2003的文件,每个文件基本格式一样,现在要求把其中一个叫"基础表"的工作簿的中的数据统计出来,我试了新建个空表Book1.xls,然后在其VBA中这样写
Sub s123()这样不行在sh1.Cells(i, 1) = Workbooks(f).Sheets(1).Cells(5, 2)
Dim f$
Dim i As Integer
Dim sh1
Set sh1 = Worksheets(1)
f = Dir(ThisWorkbook.Path & "\*.xls")
Do While f <> ""
If f <> "Book1.xls" And f <> ThisWorkbook.Name Then
Workbooks.Open f
sh1.Cells(i, 1) = Workbooks(f).Sheets(1).Cells(5, 2)
'......................
End If
Workbooks(f).Close False
Loop
End Sub