Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculate minutes between dates based on 9hr work days | Excel Worksheet Functions | |||
Trying to get work days out of two dates | Excel Worksheet Functions | |||
Work days difference between 2 dates. | Excel Worksheet Functions | |||
Difference between 2 dates, incl weekends, with variable work days | Excel Discussion (Misc queries) | |||
Difference between 2 dates, incl weekends, with variable work days | Excel Worksheet Functions |