Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created August 29, 2017 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/184b9772ae44d07def5e921e350aa39b to your computer and use it in GitHub Desktop.
Save ndthanh/184b9772ae44d07def5e921e350aa39b to your computer and use it in GitHub Desktop.
Sub FilterByDateTime()
Dim dDate As Date
Dim dbDate As Double
If IsDate(Range("B1")) Then
dbDate = Range("B1")
dbDate = DateSerial(Year(dbDate), Month(dbDate), Day(dbDate)) + _
TimeSerial(Hour(dbDate), Minute(dbDate), Second(dbDate))
Range("A1").AutoFilter
Range("A1").AutoFilter Field:=1, Criteria1:=">" & dbDate
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment