Try this code
Option Explicit
Sub cons_sheets()
Dim ws As Worksheet
Dim lrow As Long, lrow1 As Long
Application.ScreenUpdating = False
If Not Evaluate("ISREF(Summary!A1)") Then
Worksheets.Add(after:=Worksheets(Worksheets.Count)).Name = "Summary"
Else
Worksheets("Summary").Cells.ClearContents
End If
Worksheets("Summary").Range("C1:I1") = Split("Date,Description, Action,Operative,Hours,Complete,Sheet", ",")
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Summary" Then
lrow = ws.Range("C" & Rows.Count).End(xlUp).Row
ws.Range("C7:H" & lrow).Copy Worksheets("Summary").Range("C" & Rows.Count).End(xlUp).Offset(1, 0)
lrow = Worksheets("Summary").Range("I" & Rows.Count).End(xlUp).Row
lrow1 = Worksheets("Summary").Range("C" & Rows.Count).End(xlUp).Row
Worksheets("Summary").Range("I" & lrow + 1 & ":I" & lrow1).Value = ws.Name
End If
Next ws
Application.ScreenUpdating = True
End Sub
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose Tools | Macro | Macros
Select a macro in the list, and click the Run button
Bookmarks