Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compile error using array
Can anyone tell me what I'm doing wrong? I have an array in my main Sub
defined as follows: Dim ActyPrev(1000) As Single I even have a For Next loop to initialize each single variable in the array to 0 When I use it inside a For ... Next loop in another subroutine, with the integor variable Enumr8 as the loop counter, as follows: ActiveCell.Formula = ActyPrev(Enumr8) I get a message saying "Compile error: sub or function not defined" highlighting "ActyPrev". I'm using Excel 2003 but think we will be moving to 2007 soon. Any suggestions would be welcome. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compile error using array
If your array is defined within a procedure it will not be visible to other
procedures unless you pass it in as a parameter. http://www.ozgrid.com/VBA/variable-scope-lifetime.htm Tim "tmarsh7407" wrote in message ... Can anyone tell me what I'm doing wrong? I have an array in my main Sub defined as follows: Dim ActyPrev(1000) As Single I even have a For Next loop to initialize each single variable in the array to 0 When I use it inside a For ... Next loop in another subroutine, with the integor variable Enumr8 as the loop counter, as follows: ActiveCell.Formula = ActyPrev(Enumr8) I get a message saying "Compile error: sub or function not defined" highlighting "ActyPrev". I'm using Excel 2003 but think we will be moving to 2007 soon. Any suggestions would be welcome. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel VBA Compile Error when dimensioning jagged array | Excel Programming | |||
compile error - expected an array | Excel Programming | |||
formula array gives compile error | Excel Programming | |||
VBAProject name compile error, not defined at compile time | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming |