View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Excel American dates

Try to cast the date

CDate(Date1)

etc.

You may also need to Format it, but try the CDate first.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Duncan" wrote in message
oups.com...
Hi there,

In relation to my post below I found out how to get it to input the
textbox date on the form into the custom results on the filter

Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="=" & Date1,
Operator:=xlAnd _
, Criteria2:="<=" & Date2

My problem is that, if for example date1 textbox is 10/04/06 it puts it
into the filter as 04/10/06!

I dont know why it does this and I am assuming that between vb and
excel there is an american/english date differance it is compensating
for, I thought about using a datepicker control instead but that would
require the user to have that control installed in excel in order to
use it and I didnt want to make it too complicated. I know that a
textbox is not the best idea for inputting a date in case the user puts
it in a differant format but at the moment the form is really simple so
that I can just work out how to do it.

Can anybody suggest anything? maybe using listboxes to choose the date
from (day * month * Year*) but then i would still have to re-work the
order to make it work and there are only 12 months!

I am so confused, this should be simple!