Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating matrices and subsequently prosess those in a loop
Hello FellowDevelopers,
I want to define a set of arrays with the same structure but with the diferent contents. The content of each array has to be processed. The arrays vary in count, sometimes 2, sometimes it's 6. So I want to repeat processing all arrays in a loop. By naming all arrays subsequently (Arr1, Arr2 etc) with a counter I can see what array I have to process. I wrote this code with two subroutines. The problem is in the second part, (CopyOne), where I cannot use the name of the array. Any ideas? Rob Option Base 1 Public Arr1 As Variant Public Arr2 As Variant Sub CopyAll() ' Needed counters Dim intArrNr As Integer Dim intArrCount As Integer intArrCount = 2 ' Here I declare two arrays and with each array the same things have to be copied. Arr1 = Array("A", "B") Arr2 = Array("C", "D") ' Do somthing with each of the arrays For intArrNr = 1 To intArrAant CopyOne (intArrNr) Next End Sub Sub CopyOne(Nr) Dim strArrName strArrName = "Arr" & Nr ' Now, normally if I want to do something with a part of the array I do this: ' msgbox Arr1(1) and it says A ' msgbox Arr2(2) and it says D ' But now I want to do Msgbox strArrName(1) ' Tht is: take the value IN strArrName, ' which is "Arr1", and use it as the name of the array to show the first element ' How can I solve this? End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with creating a loop | Setting up and Configuration of Excel | |||
Creating a loop | Excel Discussion (Misc queries) | |||
Need help creating Loop | Excel Discussion (Misc queries) | |||
How to stop search / replace prosess in large excel worksheets | Excel Programming | |||
Creating a loop | Excel Programming |