Sub FilterSummaryDates()
'Extracts date rows from Summary sheet and places them on new sheet
Dim iRow As Long
Dim dCol As Variant 'Date column specifier
Dim Drng As Range 'Range containing filter dates
Dim dRow As Integer 'row within FilterDates range
Dim ShNum As Integer
Dim ShName As String
Dim ShRow As Long 'row on destination sheet
Set Drng = Range("FilterDates")
'dCol = InputBox("Enter Summary sheet column containing dates to be filtered" & vbLf & _
' "Can be either number of letters (e.g., ""B"" or ""2"", without quotes)", _
' "Identify column", "A")
dCol = "C" 'or 3
If IsNumeric(dCol) Then dCol = CInt(dCol)
'create new sheet
ShNum = 1
ShName = "Extracted Dates"
If SheetExists(ShName) Then
Worksheets(ShName).Activate
'clear all cells on the existing sheet
Cells.ClearContents
Else
Worksheets.Add after:=Worksheets("Summary")
ActiveSheet.Name = ShName
End If
ShRow = 5 'Start with row 5 to bypass header row in row 4
With Worksheets("Summary")
'Copy header row of Summary sheet to new (destination) sheet
.Rows(1).Copy Destination:=Rows(4)
For iRow = .Cells(65536, dCol).End(xlUp).Row To 2 Step -1
For dRow = 1 To Drng.Rows.Count
If Drng(dRow, 1) = .Cells(iRow, dCol) And Not IsEmpty(Drng(dRow, 1)) Then
' extraction date found
.Rows(iRow).Copy Destination:=Rows(ShRow)
.Rows(iRow).Delete
ShRow = ShRow + 1
Exit For
End If
Next dRow
Next iRow
End With
'sort Extracted data by date
Range("A4", Cells.SpecialCells(xlCellTypeLastCell)).Sort Cells(1, dCol), xlAscending, header:=xlYes
End Sub