Can't find certain date in search

K

Ken

Hi Group,
It's me again....just got a quick question about a date search. I am
running a macro that I can enter a date in an input box, and then ask
it to search for every date on my log that fits a criteria pertaining
to that date.....
It will find every date that it is supposed to, i.e. < search date,
except ANY dates prior to Oct 1, 2007...(format is 10/1/2007).....I
have changed the dates to text to check to see if dates prior to that
have the correct numerical format, and they do. Now if I change the
macro to > search date, the dates prior to Oct 1, 2007 show up along
with all the other dates that are actually > search date. Has anyone
ran into this type of problem, and is there anyway to correct it?
Thanks to all!
Ken
 
F

Fred Smith

It would help if you posted the code for your search. However, I suspect the
problem is "changed the dates to text". In text, January and October start
with the same number, so searching by text dates will always be problematic.
In your example, the text string 10/1/2007 comes *before* the string
2/10/2007.

Search by real Excel dates. Then you won't have this problem.

Regards,
Fred.
 
K

Ken

It would help if you posted the code for your search. However, I suspect the
problem is "changed the dates to text". In text, January and October start
with the same number, so searching by text dates will always be problematic.
In your example, the text string 10/1/2007 comes *before* the string
2/10/2007.

Search by real Excel dates. Then you won't have this problem.

Regards,
Fred.






- Show quoted text -

Hi Fred,
Thanks for your answer.... After giving it further thought as I
typed this in, my column for the search is in the correct excel date
format, but my search value WAS a string, not date, so I changed to
"Dim LSearchValue As Date" instead of String, and voila!...it is
correct! Thanks Fred for your help!
Ken
 
F

Fred Smith

Glad to help. Thanks for your feedback.

Fred.

It would help if you posted the code for your search. However, I suspect
the
problem is "changed the dates to text". In text, January and October start
with the same number, so searching by text dates will always be
problematic.
In your example, the text string 10/1/2007 comes *before* the string
2/10/2007.

Search by real Excel dates. Then you won't have this problem.

Regards,
Fred.






- Show quoted text -

Hi Fred,
Thanks for your answer.... After giving it further thought as I
typed this in, my column for the search is in the correct excel date
format, but my search value WAS a string, not date, so I changed to
"Dim LSearchValue As Date" instead of String, and voila!...it is
correct! Thanks Fred for your help!
Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top