NetWorkdays Not Recognized in 2007

K

Ken Hudson

I have the following code that I used in an Excel 2003 macro.

If NetWorkdays(Range("F38"), Range("G38"),
ThisWorkbook.Sheets(3).Range("A1:A" & HolCount)) > 14 Then
ActiveSheet.CheckBoxes("Check box 27").Value = xlOn
Else
ActiveSheet.CheckBoxes("Check box 26").Value = xlOn
End If

I have converted the macro to Excel 2007 and, when I invoke the macro, I get
a compile error - sub or function not defined.
I have Analysis Tool-Pak VBA added in.
I have atpvbaen as a reference as well as Excel and Office Object Librairies.
What am I missing that is causing this problem?
 
B

Bob Phillips

The ATP has been integrated in Excel 2007, so try

If WorksheetFunction.NetWorkdays(Range("F38"), Range("G38"),
ThisWorkbook.Sheets(3).Range("A1:A" & HolCount)) > 14 Then
ActiveSheet.CheckBoxes("Check box 27").Value = xlOn
Else
ActiveSheet.CheckBoxes("Check box 26").Value = xlOn
End If
 
L

Lyndon

Hi Bob,

I was running through this conversation with KEn but still cant get to run
the networkdays function.

ElseIf LCase(Left(cbma, 3)) = "rdd" Then
RDDdate = TextToDate(.Range("R" & indx).Value)
diffdate = NetworkDays(curdate, RDDdate)

If diffdate > RDDdur Then
.Range(sdate_col & indx).Value = "Forward RDD"
.Range(stocks_col & indx).Value = "No Action"
Else
.Range(sdate_col & indx).Value = ""
.Range(stocks_col & indx).Value = ""
End If
End If

Let me know any remedies you have in mind. Btw, i have added in Analysis
Tool-Pak VBA and used atpvbaen.xls as reference as well.

Thanks

Lyndon
 

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