![]() |
Networkdays
I want to use the NETWORKDAYS function in VB. Here is what I have:
WrkDaysInMon=Application.WorksheetFunction.Network days(StartDate,FinishDate, Worksheets("Lists").Range("V3:V24")) In the spreadsheet body it works fine with: =Networkdays(P4,R4,Lists!V3:V24) When I try to use it in a macro, I get the message "Object doesn't support this property or method" What have I done wrong? TIA GMet |
Networkdays
Networkdays is in an addin, so it is not in the WorksheetFunction object.
If you have a reference from this notebook to the Analysis toolpak VBA, then you can call it like any other VBA function WrkDaysInMon=Networkdays(StartDate,FinishDate,Work sheets("Lists").Range("V3: V24")) If not, then you need to use Application.Run WrkDaysInMon = _ Application.Run("ATPVBAEN.XLA!NetWorkDays", _ StartDate,FinishDate,Worksheets("Lists").Range("V3 :V24")) as an example from the immediate window: dt1 = date - 30 dt2 = date ? Application.Run("ATPVBAEN.XLA!NetWorkDays",dt1,dt2 ) 23 -- Regards, Tom Ogilvy "GMet" wrote in message ... I want to use the NETWORKDAYS function in VB. Here is what I have: WrkDaysInMon=Application.WorksheetFunction.Network days(StartDate,FinishDate, Worksheets("Lists").Range("V3:V24")) In the spreadsheet body it works fine with: =Networkdays(P4,R4,Lists!V3:V24) When I try to use it in a macro, I get the message "Object doesn't support this property or method" What have I done wrong? TIA GMet |
Networkdays
Hi GMet
This is a function from the Analysis Toolpak addin In VBA, go to ToolsReferences and check ATPVBAEN.XLS you can use it in your code now without the Application.WorksheetFunction before it -- Regards Ron de Bruin http://www.rondebruin.nl "GMet" wrote in message ... I want to use the NETWORKDAYS function in VB. Here is what I have: WrkDaysInMon=Application.WorksheetFunction.Network days(StartDate,FinishDate, Worksheets("Lists").Range("V3:V24")) In the spreadsheet body it works fine with: =Networkdays(P4,R4,Lists!V3:V24) When I try to use it in a macro, I get the message "Object doesn't support this property or method" What have I done wrong? TIA GMet |
All times are GMT +1. The time now is 03:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com