count days between dates

  • Thread starter Thread starter cogent
  • Start date Start date
C

cogent

Hello

I must be bleary eyed. Is there a VBA function which counts the number of
days between two dates (as in the workbooks)?

W
 
Dates & times are stored as numbers.

Therefore simply subtracting one from the other will give you the tim
between two dates. Note however that the date is the integer portio
only. If you need look at only the dates and ignore the time portio
use INT(a) - INT(b) or to round down to the nearest day int(a - b).

Hope it helps
 
Just subtract one date from the other.

If you want working days, you can get at the NETWORKDAYS fu nction by
setting a reference to ATPVBAEN.xks in Toole>References, and then calll
directly with Run.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
You just subtract

Dim a As Date, b As Date
a = #6/1/2004#
b = #6/10/2004#
MsgBox b - a
 

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

Back
Top