Sub Summary()
Dim ws As Worksheet, wsSummary As Worksheet
Dim strFind1 As String, strFind2 As String
Dim Match1 As Variant, Match2 As Variant
strFind1 = "AAA"
strFind2 = "BBB"
Application.ScreenUpdating = False
Set wsSummary = Worksheets.Add(After:=Sheets(Sheets.Count))
On Error Resume Next
wsSummary.Name = "Summary"
On Error GoTo 0
For Each ws In Worksheets
If Not ws Is wsSummary Then
With ws.Range("A1", ws.Range("A" & Rows.Count).End(xlUp))
Match1 = Application.Match(strFind1, .Cells, 0)
Match2 = Application.Match(strFind2, .Cells, 0)
If Not IsError(Match1) And Not IsError(Match2) Then
ws.Columns(1).Insert
.Offset(, -1).Value = ws.Name
ws.Rows(Match1 + 1 & ":" & Match2 - 1).Copy _
Destination:=wsSummary.Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
End With
End If
Next ws
Application.ScreenUpdating = True
End Sub
Bookmarks