LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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
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
Help with creating a loop Woodi2 Setting up and Configuration of Excel 1 April 19th 09 09:10 PM
Creating a loop JakeShipley2008 Excel Discussion (Misc queries) 1 September 8th 08 10:26 PM
Need help creating Loop Jenny B. Excel Discussion (Misc queries) 3 February 14th 07 11:26 PM
How to stop search / replace prosess in large excel worksheets palcamb Excel Programming 0 October 18th 06 01:59 PM
Creating a loop shart Excel Programming 10 December 21st 05 08:24 AM


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