how to use workdays or networkdays in VBA

G

Guest

I have a macro that needs either Workdays or networkdays to determine the
number of workdays in a month.
I have installed the "Analysis Tool Pack" and "Analysis Took Pack - VBA"
into Excel.
I am trying to use "application.worksheetfunction.networkdays(.....)"
however after I enter the "." there is no reference to either "Workdays" or
"Networkdays" from the object browser.

When I run the macro, it errors out with Run-time error 438 - Object does
not support this property or method.

Does anyone know why this is happening, and what I can do to correct this?

Thank-you
 
R

Ron Rosenfeld

I have a macro that needs either Workdays or networkdays to determine the
number of workdays in a month.
I have installed the "Analysis Tool Pack" and "Analysis Took Pack - VBA"
into Excel.
I am trying to use "application.worksheetfunction.networkdays(.....)"
however after I enter the "." there is no reference to either "Workdays" or
"Networkdays" from the object browser.

When I run the macro, it errors out with Run-time error 438 - Object does
not support this property or method.

Does anyone know why this is happening, and what I can do to correct this?

Thank-you

In the VB editor, Tools/References atpvbaen.xls

Then in your macro, just use:

Var = workdays(dt,num)


--ron
 
G

Guest

THANK-YOU Ron.

I forgot the aptvbaen.xls!

I guess this is where I slap myself on the back of the head and chalk it up
to an ID 10 T error! (I get a lot of those!)
 
R

Ron Rosenfeld

THANK-YOU Ron.

I forgot the aptvbaen.xls!

I guess this is where I slap myself on the back of the head and chalk it up
to an ID 10 T error! (I get a lot of those!)

I find I get more of those the older I get :))

Glad to help
--ron
 

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