L
longbow
Hello,
Could someone please take a look at my VBA code and advise how to mak
it work correctly:
Sub PrintOutByMonth()
'
'PrintOutByMonth Macro
'
'
'
Dim FirstDate As Date
Dim LastDate As Date
Application.ScreenUpdating = False
MsgBox ("You will be prompted to enter in a First and Last Date."
Chr(10) & Chr(10) & "This program will print out all records betwee
the two dates including the two dates you enter." & Chr(10) & Chr(10)
"For example, if you want all the records for January 2003 you woul
enter First Date of 01 Jan 2003 and Last Date of 31 Jan 2003")
FirstDate = Application.InputBox("Please Enter the First Date in D
MMM YYYY format: ", "Enter First Date")
LastDate = Application.InputBox("Please Enter the Last Date in D
MMM YYYY format: ", "Enter Last Date")
Selection.AutoFilter Field:=5, Criteria1:="" >= " & FirstDate &""
Operator:= xlAnd , Criteria2:="" <= " & LastDate & ""
End Sub
The last line starting with the word Selection is not workin
properly.
It filters all records instead of the records between the first an
last dates.
Any help would be greatly appreciated.
Kind regards,
Chris. :
Could someone please take a look at my VBA code and advise how to mak
it work correctly:
Sub PrintOutByMonth()
'
'PrintOutByMonth Macro
'
'
'
Dim FirstDate As Date
Dim LastDate As Date
Application.ScreenUpdating = False
MsgBox ("You will be prompted to enter in a First and Last Date."
Chr(10) & Chr(10) & "This program will print out all records betwee
the two dates including the two dates you enter." & Chr(10) & Chr(10)
"For example, if you want all the records for January 2003 you woul
enter First Date of 01 Jan 2003 and Last Date of 31 Jan 2003")
FirstDate = Application.InputBox("Please Enter the First Date in D
MMM YYYY format: ", "Enter First Date")
LastDate = Application.InputBox("Please Enter the Last Date in D
MMM YYYY format: ", "Enter Last Date")
Selection.AutoFilter Field:=5, Criteria1:="" >= " & FirstDate &""
Operator:= xlAnd , Criteria2:="" <= " & LastDate & ""
End Sub
The last line starting with the word Selection is not workin
properly.
It filters all records instead of the records between the first an
last dates.
Any help would be greatly appreciated.
Kind regards,
Chris. :