Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have code which seems to work properly, but I'm slightly nervous as I
haven't seen it actually written anywhere how this works. Basically the question is how do arrays get passed as parameters to a SUB() ? I've set up a toy routine that near the top says: Dim TestVector(10) As Long And later I pass it to a SUB like this: Call TestRoutine(TestVector) Apparently the TestRoutine gets compiled as if it also had that same typing/sizing for TestVector. In fact if I try to force it to some conflicting typing it compiles ok, but crashes with an error as the CALL gets executed. From putzing around with this toy setup a bit I've sort of concluded that VBA passes parameters to it's SUBs using "call by reference" rather than "call by value". Is this true? Am I safe to pass arrays to subroutines as in the CALL example above without specifying typing or sizing anywhere? Those things magically pass themselves? And if it were a large array, then all the data cells aren't really getting passed but rather only the reference to the array? I figured I should ask about this before I dig myself too big a hole and THEN find out there's a gotcha somewhere in there. Thanks... Bill |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing the value of listbox to other Subs | Excel Programming | |||
General Question regarding passing cells, ranges, cell values through subs & functions | Excel Programming | |||
General Question regarding passing cells, ranges, cell values through subs & functions | Excel Programming | |||
General Question regarding passing cells, ranges, cell values through subs & functions | Excel Programming | |||
Passing values between 2 subs ? | Excel Programming |