LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Populate an Array with a Discontiguous Values

Thanks for catching that Alan.

<<Note to self: Test **before** you post!

Rick


"Alan Beban" wrote in message
...
Rick Rothstein (MVP - VB) wrote:
I guess you could do this...

Dim MyArray()
MyArray = Array(1, 2, 3, , , , 7, 8, 9)

. . . If you declare your array with an actual type (Integer, Long,
String, etc.), then elements 4, 5, and 6 will take on the default value
for those data types (0, 0, "", etc.).

Rick


No. You will get a Type mismatch error.

Alan Beban


"PMC1" wrote in message
...

Hi,

Using Excel 2003 VBA I'm looking to Populate a 1 dimensional Array
with a Discontiguous values.

For example, instead of fully declaring a range like this
Array(1,2,3,7,8,9) I want ot pupulate the array by declaring the range
and then use something like a loop to populate the array e.g.

Dim myArRanges(1 to 3, 7 to 9)
Redim MyArray(myArRanges)

Could anyone suggest how this might be done.

Thanks

..pc


 
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
Populate an array that is a subset of a larger array? Jeff Excel Worksheet Functions 1 September 25th 07 12:51 AM
Populate an array using a formula [email protected] Excel Programming 1 October 22nd 06 10:01 PM
Populate Array Dale Excel Programming 1 April 6th 06 01:06 AM
populate array Marina Limeira Excel Programming 3 January 20th 06 05:55 PM
Populate array Beto[_3_] Excel Programming 6 December 30th 03 09:53 PM


All times are GMT +1. The time now is 07:24 AM.

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

About Us

"It's about Microsoft Excel"