Okay, There was a code which deletes a row if column "B" is empty, I removed it because I was not sure its purpose, I have now put it back. If you wish to delete a row if columns G, or F are zeros, you can change this line of code from "B" to either G, or F.
If Cells(i, "B") = "" Then"
Sub CombineAllSheets()
Dim ms As Worksheet, LRms As Long, ws As Worksheet, LR As Long, Rng As Long, i As Long
Application.ScreenUpdating = 0
Application.DisplayAlerts = 0
On Error Resume Next
If Not Evaluate("ISREF(Summary!A1)") Then
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Summary"
Else
Set ms = Sheets("Summary")
LR = ms.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If LR >= 6 Then
Sheets("Summary").Range("A6:K" & LR).ClearContents
End If
End If
For Each ws In Sheets
If ws.Name <> "Summary" And ws.Name <> "Template" Then
LR = ws.Range("A:K").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
LRms = ms.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
ws.Range("A6:K" & LR).Copy ms.Range("B" & ms.Range("B:K").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1)
Rng = ws.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row - 5
ms.Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(Rng) = ws.Name
End If
Next ws
LRms = ms.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
With ms.Range("A6:K" & LRms)
.Columns.AutoFit
End With
For i = LRms To 6 Step -1
If Cells(i, "B") = "" Then
Rows(i).EntireRow.Delete
End If
Next i
Application.ScreenUpdating = 1
Application.DisplayAlerts = 1
End Sub
Bookmarks