View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Auric__ Auric__ is offline
external usenet poster
 
Posts: 538
Default Basic question about dates

Robert Crandal wrote:

Is it possible to determine the integer value of the current date?

For example, I thought this code might help, but it doesn't:

MsgBox CInt(Date) ' Returns overflow error

I get the impression that every date in VBA is represented by
a unique integer. Is that right? If so, how do you find the
integer value for any date?


You get an overflow because CInt tries to cram whatever you pass it into a
16-bit integer, which has a max value of 32,767. Use CLng() instead.

--
- There's only one thing to do.
- Hide?
- No!