View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default How to initialize a multi-dimensional array

On 3/5/2010 11:34 AM, Chip Pearson wrote:
You can't initialize an array (with the exception of a single variant
containing an array) to values other than the standard defaults
without looping through each dimension or assigning each element by
itself. So, the answer is really that you can't do it.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Fri, 05 Mar 2010 10:18:39 -0500, wrote:

I have tried to search the web, but have now found a good way to initialize
a two (or more) dimensional array. Its easy in most other languages. Is
there a good way to do it in excel vab?

Thanks!


Here's what I think is an interesting way to have a 10 * 10 array of the
value 5 without looping. I don't believe 'Sign can be threaded once.

Sub Demo()
Dim M
M = [5*TRANSPOSE(SIGN(ROW(A1:J10))*SIGN(COLUMN(A1:J10)) )]
End Sub

= = = = = = =
HTH :)
Dana DeLouis