Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Referring to multiple elements of an array (VB)

Hi, is there a way to refer to multiple elements of an array in a
single instruction, without of course having to loop through the array?
Like in Matlab where one could, for example, refer to first "n"
elements of the second column of an array simply using:
array_example(1:n,2).
thnx for help,

Phil

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Referring to multiple elements of an array (VB)

Hi Phil

You could take assign a horizontal or vertical slice of an array to a
variant

va = application.index(myArray, row)
va = application.index(myArray, ,col)

But I don't know any way to directly refer to a segment of an array's row or
column, I don't think possible.

I'm not sure this index method would be any quicker than looping, I suspect
not. Also would error in xl2000 if total number of elements exceeds 5461

Regards,
Peter T

"Phil" wrote in message
oups.com...
Hi, is there a way to refer to multiple elements of an array in a
single instruction, without of course having to loop through the array?
Like in Matlab where one could, for example, refer to first "n"
elements of the second column of an array simply using:
array_example(1:n,2).
thnx for help,

Phil



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Referring to multiple elements of an array (VB)

Pete, thanks for the insight. Combining the "index" function with
dynamic arrays did the trick.

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
Use formulas for array elements hmm Excel Discussion (Misc queries) 3 December 3rd 07 01:15 PM
Reference Elements w/in an Array M Moore Excel Discussion (Misc queries) 2 October 16th 06 03:33 PM
Non-unique elements in an array Andrew Excel Discussion (Misc queries) 1 August 22nd 05 11:58 AM
Number of elements in an array Neal Zimm Excel Programming 4 August 12th 05 11:30 AM
Shifting Array Elements Trip[_3_] Excel Programming 6 July 30th 05 07:30 PM


All times are GMT +1. The time now is 08:30 AM.

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"