T
tudorpe
I have created this code:
Sub Macro1()
Dim mydate1 As Date
Dim mydate2 As Date
mydate1 = Range("p12")
mydate2 = Range("q12")
Sheets("Records").Select
Range("a1").Select
Selection.AutoFilter Field:=1, Criteria1:=">" & mydate1
Operator:=xlAnd _
, Criteria2:="<" & mydate2
End Sub
what it does is filter a group of records i have by their date, the
dates are obtained from p12 & p13 which in turn are CONCATENATEs of th
three cells above, these cells are validated cells which allow the use
to input
1-31 (the day) in the first cell
1-12 (the month) in the second cell
and 2004-2010 (the year) in the final cell.
In between each number is a "/" the cells P12 & Q12 are both formate
"dd/mm/yyyy".
The problem is, when the macro is run ALL entries in the database ar
filtered out, but when i check it by clicking on "custom" in th
autofilter box the date is correct and when i click OK to exit, th
correct records are displayed!!!
I'm stumped! - any help would be appreciate
Sub Macro1()
Dim mydate1 As Date
Dim mydate2 As Date
mydate1 = Range("p12")
mydate2 = Range("q12")
Sheets("Records").Select
Range("a1").Select
Selection.AutoFilter Field:=1, Criteria1:=">" & mydate1
Operator:=xlAnd _
, Criteria2:="<" & mydate2
End Sub
what it does is filter a group of records i have by their date, the
dates are obtained from p12 & p13 which in turn are CONCATENATEs of th
three cells above, these cells are validated cells which allow the use
to input
1-31 (the day) in the first cell
1-12 (the month) in the second cell
and 2004-2010 (the year) in the final cell.
In between each number is a "/" the cells P12 & Q12 are both formate
"dd/mm/yyyy".
The problem is, when the macro is run ALL entries in the database ar
filtered out, but when i check it by clicking on "custom" in th
autofilter box the date is correct and when i click OK to exit, th
correct records are displayed!!!
I'm stumped! - any help would be appreciate