NetWorkDays in VBA?

  • Thread starter Thread starter Otto Moehrbach
  • Start date Start date
O

Otto Moehrbach

Excel 2003, WinXP
Is there a way to get the equivalent of the worksheet NETWORKDAYS function
in VBA? I tried the Application.WorkSheetFunction.NetWorkDays but that is
not supported.
Thanks for your help. Otto
 
Networkdays is in the Analysis tookpak (an Addin) called like (demo'd from
the immediate window)

? application.run
("ATPVBAEN.XLA!Networkdays","10/01/1998","12/01/1998","11/26/1998" )
43


so it isn't part of the WorksheetFunctions object.
 
To use NETWORKDAYS in VBA, it must be loaded as an from the Excel Tools,
Add-Ins menu. Then, in the VBA Editor, set a reference to that add-in. Go
to the Tools menu, References, and put a check next to ATPVBAEN.xls (lower
case on my machine).

Then simply call it like

MsgBox networkdays(Date, Date + 10)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Note that there are two ways to do it.

Bob showed you how by creating a reference
I showed you how without creating a reference.

Just to clarify.
 
Back
Top