View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default compile error - expected an array

THANKS TOM!!!!!

"Tom Ogilvy" wrote:

to demonstrate usage:

set Holidays = Range("A1:A10")
dt = application.Run("ATPVBAEN.XLA!Workday",date, 20, Holidays)
Msgbox format(dt,"mmm dd, yyyy")

Would show
Oct 19, 2006
if there are no holidays in between.

the other post was inadvertently posted there. It was for another thread.

--
Regards,
Tom Ogilvy


"John" wrote:

thanks Tom...

For i = Dates.Count To 1 Step -1
DTadj(i) = (Application.Run.WORKDAY(Dates(i), 1, Holidays)) - Dates(i)
Next

this still doesn't work?

"Tom Ogilvy" wrote:

Next error - Workday isn't a worksheetfunction. It is in the Analysis
toolpak - VBA and should be called using application.Run (or if you have a
reference to that addin, call it like a builtin VBA function).

--
Regards,
Tom Ogilvy


"John" wrote:

didn't Dim my variable correctly :)

"John" wrote:

Here is the code and I am getting a compile error...

any ideas?

For a = Dates.Count To 0 Step -1
DTadj(a) = Application.WorksheetFunction.workday(Dates(a), 1,
Holidays) - Dates(a)
Next