Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default compile error - expected an array

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default compile error - expected an array

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default compile error - expected an array

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default compile error - expected an array

Public Type Material
MatNum As Integer
MatDate() As Date
End Type

Public matType() As Material

Const MaxMaterials As Long = 12
Sub ABCEFG()
ReDim matType(1 To MaxMaterials)
For i = 1 To MaxMaterials
ReDim matType(i).MatDate(1 To 10)
Next

End Sub

--
Regards,
Tom Ogilvy


"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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default compile error - expected an array

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default compile error - expected an array

wow is that for my post? I am confused if it is..

"Tom Ogilvy" wrote:

Public Type Material
MatNum As Integer
MatDate() As Date
End Type

Public matType() As Material

Const MaxMaterials As Long = 12
Sub ABCEFG()
ReDim matType(1 To MaxMaterials)
For i = 1 To MaxMaterials
ReDim matType(i).MatDate(1 To 10)
Next

End Sub

--
Regards,
Tom Ogilvy


"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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default compile error - expected an array

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

  #8   Report Post  
Posted to microsoft.public.excel.programming
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

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default compile error - expected an array

It's for a different question.

John wrote:

wow is that for my post? I am confused if it is..

"Tom Ogilvy" wrote:

Public Type Material
MatNum As Integer
MatDate() As Date
End Type

Public matType() As Material

Const MaxMaterials As Long = 12
Sub ABCEFG()
ReDim matType(1 To MaxMaterials)
For i = 1 To MaxMaterials
ReDim matType(i).MatDate(1 To 10)
Next

End Sub

--
Regards,
Tom Ogilvy


"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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Error: Expected Variable or Procedure, Not Project BEEJAY Excel Programming 7 November 6th 06 08:40 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
compile error: Expected: = ...Why? cesw[_2_] Excel Programming 3 September 10th 05 12:41 AM
Compile Error: Expected End Property George J[_3_] Excel Programming 4 August 3rd 05 03:35 PM
compile error: expected variable or function MMM Excel Discussion (Misc queries) 3 December 24th 04 03:11 PM


All times are GMT +1. The time now is 08:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"