NetWorkDays in VBA?

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
 
T

Tom Ogilvy

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.
 
B

Bob Phillips

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)
 
T

Tom Ogilvy

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.
 

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

Top