| 
    
     |  | >  With Workbooks.Open(f) >   For Each ws In Worksheets
 ↑
 .がない。
 Openしたばかりのアクティブブック対象となるので
 同じようのは動くけど。
 
 この辺↓、なんかフラグつかったりごちゃごちゃしすぎに感じません?
 
 >  For Each ws In Worksheets
 >   If ws.Name = "A" Then flag = True
 >  Next ws
 >  If flag = False Then Close
 >  If flag = True Then
 
 >    With .Worksheets("A")
 
 こんな感じで良いと思うけど?
 
 For Each ws In Worksheets
 If ws.Name = "A" Then
 With ws
 i = 2
 Do While .Cells(i, 1).Value <> ""
 Sheet1.Cells(j, 1).Value = .Cells(i, 1).Value
 Sheet1.Cells(j, 2).Value = .Cells(i, 2).Value
 Sheet1.Cells(j, 3).Value = .Cells(i, 3).Value
 Sheet1.Cells(j, 4).Value = .Cells(i, 4).Value
 Sheet1.Cells(j, 5).Value = .Cells(i, 5).Value
 Sheet1.Cells(j, 6).Value = .Cells(i, 6).Value
 Sheet1.Cells(j, 7).Value = .Cells(i, 7).Value
 Sheet1.Cells(j, 8).Value = .Cells(i, 8).Value
 Sheet1.Cells(j, 9).Value = .Cells(i, 9).Value
 Sheet1.Cells(j, 9).Value = .Cells(i, 10).Value
 i = i + 1
 j = j + 1
 Loop
 end with
 end if
 next
 
 因みに
 フラグを立てる flag = True
 フラグを降ろす flag = False
 (下すって変換されちゃってたけど)
 
 
 |  |