PC Review


Reply
Thread Tools Rate Thread

Declare Non-contiguous Columns as Arrays

 
 
ward376
Guest
Posts: n/a
 
      20th Mar 2009
How can I declare multiple columns as arrays where each element of
each array is a combination of adjacent (on the same row) values from
two columns?

I have three columns - the first contains a facility id, the second
contains a material id and the third contains a material id to be
referenced by the material id in the second column.

I want to compare a combination of the first and second columns'
values to a combination of the first and third columns' values to root
out 'loops' (references pointing both ways within each facility) and
instances of the second column values referring to multiple values in
the third column. There will be empties in the third column, but not
the first or second.

Thanks!
Cliff Edwards

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      20th Mar 2009
I'm not entirely clear what you want to do, but the following code
might get you started. It declares an array Arr with 5 rows and 3
columns and then loads the array with the values from rows 1:5 columns
A, C, and E.


Dim Arr(1 To 5, 1 To 3) As Variant
Dim RI As Long
Dim CI As Long

' load the array with values from rows
' 1 to 5, columns A, C, and E.
For RI = LBound(Arr) To UBound(Arr)
Arr(RI, 1) = Cells(RI, "A")
Arr(RI, 2) = Cells(RI, "C")
Arr(RI, 3) = Cells(RI, "E")
Next RI
' list the array
For RI = LBound(Arr) To UBound(Arr)
Debug.Print Arr(RI, 1), Arr(RI, 2), Arr(RI, 3)
Next RI


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Fri, 20 Mar 2009 11:53:45 -0700 (PDT), ward376
<(E-Mail Removed)> wrote:

>How can I declare multiple columns as arrays where each element of
>each array is a combination of adjacent (on the same row) values from
>two columns?
>
>I have three columns - the first contains a facility id, the second
>contains a material id and the third contains a material id to be
>referenced by the material id in the second column.
>
>I want to compare a combination of the first and second columns'
>values to a combination of the first and third columns' values to root
>out 'loops' (references pointing both ways within each facility) and
>instances of the second column values referring to multiple values in
>the third column. There will be empties in the third column, but not
>the first or second.
>
>Thanks!
>Cliff Edwards

 
Reply With Quote
 
ward376
Guest
Posts: n/a
 
      20th Mar 2009
Thanks Chip!

Cliff Edwards
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
averaging non-contiguous data using arrays Matt S Microsoft Excel Programming 1 2nd Jun 2009 09:13 PM
are arrays contiguous in memory? Peteroid Microsoft VC .NET 38 20th Dec 2005 11:28 PM
How to declare arrays within a structure? John Dann Microsoft VB .NET 8 23rd Jun 2004 07:46 PM
Re: Declare Multidimensional Arrays Alan Beban Microsoft Excel Programming 5 21st Aug 2003 08:37 AM
Re: Declare Multidimensional Arrays Alan Beban Microsoft Excel Programming 0 20th Aug 2003 07:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:33 PM.