|
雰囲気を入れます。
ブックのシートが不明です。
Public sh1 As Object
Public sh2 As Object
Public cnt As Integer
Sub Get_DIR()
Dim MyPath As String, MyName As String
Set sh1 = Workbooks(1)
MyPath = ThisWorkbook.Path
MyName = Dir(MyPath & "\Book*.xls")
Do While MyName <> ""
Workbooks.Open Filename:=MyPath & "\" & MyName
Set sh2 = Workbooks(2)
Call m2_SUB(MyName)
sh2.Close
MyName = Dir
Loop
End Sub
Sub m2_SUB(MyName)
Dim 計 As Long
計 = 0
Dim WS As Worksheet
For Each WS In sh2.Worksheets
cnt = 1 + cnt
sh1.Sheets("Sheet1").Range("A" & cnt) = sh2.Sheets(WS.Name).Range("c24")
Next
End Sub
|
|