kevvukeka
06-29-2013, 01:46 AM
Hi All,
I have a master sheet with around 3000 rows of data. In which column B contains date("Format Short date "29 - Jun - 2013" format). Now i tried to autofilter the data on current date but I am not able to do so. Can someone help me whats wrong with my below code.
sub test()
Dim x as date
x= date
activesheet.usedrange.autofilter field:=2,criteria1:=x
end sub
[VBA]
i also tried
[VBA]
Sub test1()
Dim x As Date, y As Date
'Dim y As Long
x = Date
x = x - 1
'x = DateSerial(Year(Now), Month(Now), Day(Now))
y = x + 2
ActiveSheet.UsedRange.AutoFilter field:=2, Criteria1:=">" & x, Operator:=xlAnd, Criteria1:="<" & y
End Sub
with first code i see zero records, though i have few lines with currentdate
with second code, i see all the records though filter is applied.
Kindly help, the other part pf my code depends on this filtered data.
Thanks in advance....
I have a master sheet with around 3000 rows of data. In which column B contains date("Format Short date "29 - Jun - 2013" format). Now i tried to autofilter the data on current date but I am not able to do so. Can someone help me whats wrong with my below code.
sub test()
Dim x as date
x= date
activesheet.usedrange.autofilter field:=2,criteria1:=x
end sub
[VBA]
i also tried
[VBA]
Sub test1()
Dim x As Date, y As Date
'Dim y As Long
x = Date
x = x - 1
'x = DateSerial(Year(Now), Month(Now), Day(Now))
y = x + 2
ActiveSheet.UsedRange.AutoFilter field:=2, Criteria1:=">" & x, Operator:=xlAnd, Criteria1:="<" & y
End Sub
with first code i see zero records, though i have few lines with currentdate
with second code, i see all the records though filter is applied.
Kindly help, the other part pf my code depends on this filtered data.
Thanks in advance....