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 determining datatype

11-23-05 is a valid date to VBA (it uses US date format), but it rejects
invalid dates and na for me.

Perhaps show the full code and give some sample data to better see.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"davegb" wrote in message
oups.com...
I have a macro that looks for a date in a cell, then based on whether
or not it finds one, proceeds. But I can't find a way to test for a
date reliably. I did some research here, and I've tried "If
Isdate(variablename) then" and "If datatype (variablename)="date"
then", but neither works. Some of the tested cells contain "na", some
dates in the format 11-23-05, but the macro proceeds as if they were
all dates. Any ideas what could be amiss?
Thanks for the help, and Happy Thanksgiving!