I'm sure there's a better way to do it but here's something that I put together based on something I already had.
Delete the blank summary tab you have, insert in Column A on each tab a column for "Event", then run this and delete anything that's already closed which should sort to the top and you'll be left with a list sorted by "Event" then by "Due Date".
One problem that I came across that maybe someone else can help with is how to get the range to be a dynamic selection so in the event that you go passed a certain number of lines it will still pick it up. I'm sure there's also a way to get it to delete anything that has data in the date closed column for you but this is hopefully a start that get's you moving in the right direction.
Sub MergeSheets()
'''''''''''''''''''''''''''''''''''''''''''''''''
'Copy data from all Worksheets to a new Worksheet
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim intI, intSheetsCount As Integer
Dim blnFirstCopyComplete As Boolean
Dim NewSheet As Worksheet
Dim rngRange As Range
Dim lngLastRow
'Create a new Worksheet and move it before all Worksheets
Set NewSheet = ActiveWorkbook.Worksheets.Add(Before:=Worksheets(1))
'Get the number of Worksheets
intSheetsCount = ActiveWorkbook.Worksheets.Count
'Excluding the new Worksheet, copy all other Worksheets
'one by one
For intI = 2 To intSheetsCount
'This is the Range that will be copied to the new Worksheet
With ActiveWorkbook.Worksheets(intI)
Set rngRange = .Range(.Cells(1, 1), _
.Cells.SpecialCells(xlCellTypeLastCell))
End With
With NewSheet
'If this is the first paste, do it on the first row
If Not blnFirstCopyComplete Then
rngRange.Copy Destination:=.Cells(1, 1)
blnFirstCopyComplete = True
'Else, first find the cell where the copied range will be
'pasted and proceed with the paste
Else
'This is last row of the so far created new Worksheet data
lngLastRow = .Range(.Cells(1, 1), _
.Cells.SpecialCells(xlCellTypeLastCell)).Rows.Count
'Do the paste on the next row
rngRange.Copy Destination:=.Cells(lngLastRow + 1, 1)
End If
End With
Next 'intI
ActiveSheet.Name = "Summary"
Worksheets("Summary").Columns("a:g").AutoFit
Cells.Select
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add Key:=Range("d2:d500000") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("A1:g500000")
.HEADER = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add Key:=Range("a2:a500000") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("A1:g500000")
.HEADER = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add Key:=Range("e2:e500000") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("A1:g500000")
.HEADER = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Bookmarks