Hi guys
I've got a spreadsheet which in column 3, contains date and time e.g. 12/12/200 08:36 . What i want to do is have a macro embedded into a button which prompts the user for 2 dates, start and finish. The macro will then autofilter the records in the spreadsheet to only those in between the pre-entered dates. But my code isn't working, any ideas?
Sub PrintOutByMonth()
Dim FirstDate As Date
Dim LastDate As Date
Application.ScreenUpdating = False
FirstDate = Application.InputBox("Please Enter the First Date in DD MM YYYY hh:ss format: ", "Enter First Date")
LastDate = Application.InputBox("Please Enter the Last Date in DD MM YYYY format: ", "Enter Last Date")
Selection.AutoFilter Field:=1, Criteria1:=">=" & FistDate, Operator:=xlAnd _
, Criteria2:="<=" & LastDate
End Sub
Any help greatly appreciated, thanks in advance
olly
I've got a spreadsheet which in column 3, contains date and time e.g. 12/12/200 08:36 . What i want to do is have a macro embedded into a button which prompts the user for 2 dates, start and finish. The macro will then autofilter the records in the spreadsheet to only those in between the pre-entered dates. But my code isn't working, any ideas?
Sub PrintOutByMonth()
Dim FirstDate As Date
Dim LastDate As Date
Application.ScreenUpdating = False
FirstDate = Application.InputBox("Please Enter the First Date in DD MM YYYY hh:ss format: ", "Enter First Date")
LastDate = Application.InputBox("Please Enter the Last Date in DD MM YYYY format: ", "Enter Last Date")
Selection.AutoFilter Field:=1, Criteria1:=">=" & FistDate, Operator:=xlAnd _
, Criteria2:="<=" & LastDate
End Sub
Any help greatly appreciated, thanks in advance
olly