View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Debra Dalgleish Debra Dalgleish is offline
external usenet poster
 
Posts: 2,979
Default Start and end criteria macro

Try converting the dates to serial numbers:

Selection.AutoFilter Field:=1, _
Criteria1:="=" & CLng(CDate(strStart)), Operator:=xlAnd, _
Criteria2:="<=" & CLng(CDate(strEnd))


xsilverx wrote:
Thank you for explainging the above.

I have adapted part of the suggested VBA for my project and only use
the part:

Dim strStart As String
Dim strEnd As String
strStart = Application.InputBox("Start Date, (dd/mm/yyyy)")
strEnd = Application.InputBox("End Date, (dd/mm/yyyy)")

Selection.AutoFilter Field:=1, _
Criteria1:="=" & CDate(strStart), Operator:=xlAnd, _
Criteria2:="<=" & CDate(strEnd)

It all works ok but after the filter there is no displayed data. I have
tried the record macro function and adapted in parts for input but this
does not resolve the problem.

This problem does not occur when the custom filter is used manually.

I do require the macro as the spreadsheet is used by a number of people
with different levels of IT knowlege.



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html