View Single Post
 
Old 02-20-2017, 05:47 PM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Code:
Sub Filter_for_last_day()
    Dim lr As Long
    Dim crit As Double
    
With Sheets("sheet1")
    lr = .Cells(Rows.Count, "A").End(xlUp).Row
    crit = .Cells(Rows.Count, "A").End(xlUp).Value2
    MsgBox "This is what Excel actually sees in the last cell" & vbLf & crit
    .Range("A2:A" & lr).AutoFilter Field:=1, Operator:=xlFilterValues, Criteria1:=">" & Int(crit)
End With

End Sub
The message box is just to show what's actually in that last cell.
To the left of the decimal is the day (the number of days since Jan 1, 1900) and
to the right is the time as a decimal amount of 24 hours.
Msgbox can be removed or commented out.
Reply With Quote