Thread: VBA arrays
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave[_2_] Dave[_2_] is offline
external usenet poster
 
Posts: 10
Default VBA arrays

Create a new array A1:
For i = 4 to 8
j= j+1
A1(j) = A(i)
Next i

Then pass the new array to your sub:
Call SomeSub(A1)

remember to dim the variables and that if you don't use option base 1 that
arrays start at 0 not 1 in visual basic.


"hokiebird" wrote in message
...

Hello all, first time post

I'm trying to access only part of an array.

Suppose A in an array of integers with 10 cells...
Dim A(1 to 10) as integer

..some code to fill up A

Now lets say I want to call a subroutine with only cells 4-8, how do I
do this?

In other codes we can do something like this...
Call SomeSub(A(4:8))
but i can't for the life of me figure out how to do this in VBA...
HELP!


--
hokiebird
------------------------------------------------------------------------
hokiebird's Profile:

http://www.excelforum.com/member.php...o&userid=16308
View this thread: http://www.excelforum.com/showthread...hreadid=276996