Ok, I have a code that is working great, except for two things. I'd like to have the information on the Summary sheet start on Row 6, and have the names of the worksheets the info came from in Column A.
Code is as follows
Sub CombineAllSheets()
Dim wsCopyTo As Worksheet
Dim lngLastRow As Long
Dim lngLoopCtr As Long
Dim ws As Worksheet
Dim lngLastRow2 As Long
Sheets(1).Select
Application.ScreenUpdating = False
On Error Resume Next
With Worksheets("Summary")
If Err Then Worksheets.Add
ActiveSheet.Name = "Summary"
On Error GoTo 0
Set wsCopyTo = Sheets("Summary")
End With
For Each ws In Sheets
If ws.Name <> "Summary" Then
lngLastRow2 = ws.Cells(Rows.Count, "B").End(xlUp).Row
lngLastRow = wsCopyTo.Cells(Rows.Count, "B").End(xlUp).Row
ws.Range("A6:K" & lngLastRow2).Copy wsCopyTo.Range("B" & lngLastRow + 1)
End If
Next
lngLastRow = wsCopyTo.Cells(Rows.Count, "B").End(xlUp).Row
With wsCopyTo.Range("A6:K" & lngLastRow)
.Columns.AutoFit
End With
For lngLoopCtr = lngLastRow To 2 Step -1
If Cells(lngLoopCtr, "B") = "" Then
Rows(lngLoopCtr).EntireRow.Delete
End If
Next lngLoopCtr
Application.ScreenUpdating = True
End Sub
Also would like to have the Summary automatically update if I enter new data into the individual sheets, and to know, if I format the Summary sheet previously to running the macro, will it keep the formatting? (ex. hide columns etc)
I hope this is enough information, and any help will be greatly appreciated.
Thanks in advance!!
Bookmarks