stelladave
New Member
- Joined
- Jul 19, 2012
- Messages
- 7
Hello,
I am having an issue with an Autofilter in VBA. See below for the current code. The desired result is to specify two dates and filter between those dates but also include the dates as well. Currently the filter is not returning the EDate values (it is returning the Sdate values). Also, I need to be able to return the date if Sdate and Edate are equal to eachother (currently not working).
Sdate = Sheet1.Range("C1").Value
EDate = Sheet1.Range("G1").Value
Workbooks.Open Filename:=Pth & "\Phone.csv"
SrsFnm = ActiveWorkbook.Name
Workbooks(SrsFnm).Activate
Sheets(1).AutoFilterMode = False
Sheets(1).Range("A:BB").AutoFilter
Sheets(1).Range("A:BB").AutoFilter Field:=11, Criteria1:=">=" & Sdate, Operator:=xlAnd, Criteria2:="<=" & EDate
Any help would be much appreciated.
Thanks,
Dave
I am having an issue with an Autofilter in VBA. See below for the current code. The desired result is to specify two dates and filter between those dates but also include the dates as well. Currently the filter is not returning the EDate values (it is returning the Sdate values). Also, I need to be able to return the date if Sdate and Edate are equal to eachother (currently not working).
Sdate = Sheet1.Range("C1").Value
EDate = Sheet1.Range("G1").Value
Workbooks.Open Filename:=Pth & "\Phone.csv"
SrsFnm = ActiveWorkbook.Name
Workbooks(SrsFnm).Activate
Sheets(1).AutoFilterMode = False
Sheets(1).Range("A:BB").AutoFilter
Sheets(1).Range("A:BB").AutoFilter Field:=11, Criteria1:=">=" & Sdate, Operator:=xlAnd, Criteria2:="<=" & EDate
Any help would be much appreciated.
Thanks,
Dave