Try this code. I added a new Summary sheet that populates when the code is run via the summarize button.
Option Explicit
Sub ConsolidateData()
Dim Sr, lr, lrs As Long
Dim w As Worksheet
Dim Rng As Range
Dim x As Date
Optimiser (True)
On Error Resume Next
On Error GoTo 0
Sr = 3
'x = Sheets("Summary").Range("B1").Value
lr = Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Summary").Range("A2:O" & lr).Delete
For Each w In ActiveWorkbook.Sheets
On Error Resume Next
If w.Name = "Summary" Or InStr(w.Name, "_") >= 1 Then GoTo Skip
w.Select
lrs = Cells(Rows.Count, 1).End(xlUp).Row
Set Rng = w.Range("A5:O" & lrs) '.Select 'Cells.Select
With Rng
.AutoFilter
.AutoFilter Field:=2, Criteria1:="<> """
.SpecialCells(xlCellTypeVisible).Copy
w.AutoFilterMode = False
End With
Sheets("Summary").Activate
Sheets("Summary").Range("A" & Sr).Value = w.Name
Sheets("Summary").Range("A" & Sr + 1).PasteSpecial xlValues
Sheets("Summary").Range("A" & Sr + 1).PasteSpecial xlFormats
' Turn off filter
Sr = Sr + lrs - 2
Set Rng = Nothing
Skip:
Next
Optimiser (False)
End Sub
Private Sub Optimiser(T As Boolean)
T = Not T
Application.ScreenUpdating = T
Application.DisplayAlerts = T
Application.EnableEvents = T
Application.DisplayStatusBar = T
ActiveSheet.DisplayPageBreaks = False
If T = False Then
Application.Calculation = xlCalculationManual
Else
Application.Calculation = xlCalculationAutomatic
End If
End Sub
Bookmarks