Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default Declare Non-contiguous Columns as Arrays

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Declare Non-contiguous Columns as Arrays

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
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default Declare Non-contiguous Columns as Arrays

Thanks Chip!

Cliff Edwards
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
Difficulty with Arrays in Excel's DECLARE statement MichaelDavid Excel Programming 0 March 3rd 09 07:41 AM
Building Non-Contiguous Arrays For Use With Linest Marston Excel Worksheet Functions 4 May 19th 08 03:07 PM
Copying non-contiguous columns to contiguous columns Bob Excel Programming 1 August 10th 06 03:45 AM
Declare Multidimensional Arrays Alan Beban[_3_] Excel Programming 3 August 21st 03 02:40 AM
Declare Multidimensional Arrays Alan Beban[_3_] Excel Programming 0 August 20th 03 07:03 PM


All times are GMT +1. The time now is 09:00 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"