View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] jzamilpa3@yahoo.com is offline
external usenet poster
 
Posts: 48
Default time frame restriction

it starts working correctly in the beginning but it gives a type
mismatch error for the code you helped me out with. any suggestions

On May 13, 8:19*am, Keith74 wrote:
Hi Jzamil

Dates are one big problem in excel, you need to be certain which date
format you're working with e.g. is it 01/02/2008 or 02/01/2008, so
step through your code and make sure. I'd replace your IF with

* * If cdate(Sheet2.Cells(a, 2)) = cdate(Sheet12.Cells(6, 3)) And
cdate(Sheet2.Cells(a, 2)) <= cdate(Sheet12.Cells(6, 4)) Then

to confirm that excel is treating the values as dates, though you may
be better off using .NumberFormat.

hope this gets you started.

Keith