#### Using array variables

You can assign values to elements of an array and also use the values of the elements for other computations:

    Global x() As String
    x = Array ("hello", "bye", "again")
    'Now x is Array ("hello", "once", "again")
    x (2) = "once"
    'The statement below would cause an error if not
    'commented out since the array has size 3
    'x (4) = "zap"
    'The formula returns the String "HELLO"
    formula = UCase (x (1))

The Redim and Redim Preserve keywords can be used to resize an array, which is useful if you want to add extra information to it. Redim erases the previous contents of the array first before resizing it whereas Redim Preserve preserves the previous contents.

    Dim x () As Number
    Redim x (2) 'Now x is Array (0, 0)
    x (2) = 20 'Now x is Array (0, 20)

Redim x (3) 'Now x is Array (0, 0, 0)

    x (3) = 30 'Now x is Array (0, 0, 30)
    Redim Preserve x (4) 'Now x is Array (0, 0, 30, 0)
    formula = "finished"

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com