Re: Q on the Array function...



MLH wrote:
How would I modify the following to achieve a 2-dimensional array?

Dim MyWeek, MyDay
MyWeek = Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
' Return values assume lower bound set to 1 (using Option Base
' statement).
MyDay = MyWeek(2) ' MyDay contains "Tue".
MyDay = MyWeek(4) ' MyDay contains "Thu".

In other words, I want the array to hold
"Monday","Segunda-feira"
"Tuesday","Terca-feira"
"Wednesday","Quarta-feira"
"Thursday","Quinta-feira"

Why bother?
Put the data in a table and forget the array.
Or use a collection with Monday as the key and Segunda-feira
as the value.
Or create a UDT with members for English and Portuguese and
whatever other language you want and put them in a collection.
Or just about anything but a muli-dimensional array.


.



Relevant Pages

  • Re: Breaking up a Text String
    ... you should never refer to array element ... Dim Arr As Variant ... depends on the Option Base statement: ... depending on the Option Base statement. ...
    (microsoft.public.excel.programming)
  • Re: Setting based 1 Arrays
    ... The fact that the Mid function and other string functions count the first character of a string as being character number 1 whereas the base of an array is as determined by the programmer and otherwise defaults to zero does NOT make either of those things random. ... Option Base Statement. ... Because the default base is 0, the Option Base statement ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Redim Preserve dynamic array gives subscript out of range - Ac
    ... Option Base 1 did the trick. ... Dim rstDROP As ADODB.Recordset ... Dim intCountOfDropArray As Integer ... To do this we must increment the last dimension of the array by one...and ...
    (microsoft.public.access.formscoding)
  • Re: Selective Range extraction depends on the cell outcome
    ... Dim RangeNames As Variant ... The Array method returns an array from the series of input strings. ... you have Option Base 0 or no Option Base statement at the top of your ... Then help me to select each range depending on the answer in cell A5. ...
    (microsoft.public.excel.programming)
  • Re: "Listing Contents of Sub-Folders"
    ... Have you looked at the Array statement? ... the array bounds are 0 to 4 with no Option Base statement, ... Dim Arrspecifies the upper bound and omits the lower bound. ... the following array declarations are the same. ...
    (microsoft.public.excel.programming)