|
有る程度解るみたいなので、
ファイルをオープンし、集計のサンプル。。
SUB ルーチングの
Sub m2m10_SUB(MyName) の部分を修正すれば、
ファイルの数は関係有りません。
Public sh1 As Object
Public sh2 As Object
Public cnt As Integer
Sub DIR_Get()
Dim MyPath As String, MyName As String
Set sh1 = Workbooks(1)
MyPath = ThisWorkbook.Path ' 参照のホルダーになります
MyName = Dir(MyPath & "\*.xls")
Do While MyName <> ""
Workbooks.Open Filename:=MyPath & "\" & MyName
Set sh2 = Workbooks(2)
Call m2m10_SUB(MyName)
sh2.Close
MyName = Dir
Loop
End Sub
Sub m2m10_SUB(MyName)
Dim 計 As Long
計 = 0
Dim WS As Worksheet
For Each WS In sh2.Worksheets
計 = sh2.Sheets(WS.Name).Range("B6") + 計 '******集計****
Next
cnt = 1 + cnt
sh1.Sheets("Sheet1").Range("A" & cnt) = MyName
sh1.Sheets("Sheet1").Range("b" & cnt) = 計
End Sub
|
|