Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Work out Days Between Two Dates

Hi Is there a way to workout days between two dates like networkdays in code.
any help will be much appreciated
Charles
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Work out Days Between Two Dates

Hi Charles,

One way:

Sub a()
Dim x As Long
Dim d1 As Long, d2 As Long
d1 = DateSerial(2000, 1, 1)
d2 = DateSerial(2002, 1, 1)
x = Application.Evaluate("=NETWORKDAYS(" & d1 & "," & d2 & ")")
Debug.Print x
End Sub

HTH

Peter Beach

"vqthomf" wrote in message
...
Hi Is there a way to workout days between two dates like networkdays in

code.
any help will be much appreciated
Charles



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Work out Days Between Two Dates

On Fri, 6 Jan 2006 21:16:14 +1300, "Peter Beach" wrote:

Hi Charles,

One way:

Sub a()
Dim x As Long
Dim d1 As Long, d2 As Long
d1 = DateSerial(2000, 1, 1)
d2 = DateSerial(2002, 1, 1)
x = Application.Evaluate("=NETWORKDAYS(" & d1 & "," & d2 & ")")
Debug.Print x
End Sub

HTH


or, if you set a reference to atpvbaen.xls:

Sub a()
Dim x As Long
Dim d1 As Long, d2 As Long
d1 = DateSerial(2000, 1, 1)
d2 = DateSerial(2002, 1, 1)
x = NETWORKDAYS(d1, d2)
Debug.Print x
End Sub



--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate minutes between dates based on 9hr work days JQS Excel Worksheet Functions 1 September 3rd 08 09:14 AM
Trying to get work days out of two dates erick-flores Excel Worksheet Functions 8 July 26th 08 10:41 AM
Work days difference between 2 dates. Jeremy Excel Worksheet Functions 7 February 5th 08 05:36 PM
Difference between 2 dates, incl weekends, with variable work days babryanton Excel Discussion (Misc queries) 4 July 11th 06 06:56 PM
Difference between 2 dates, incl weekends, with variable work days babryanton Excel Worksheet Functions 0 July 7th 06 11:24 PM


All times are GMT +1. The time now is 12:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"