Results 1 to 2 of 2

Thread: Inserting Values into an Array

  1. #1
    Guest

    Smile

    Hi,

    I have an array with 20 spaces and know the data I need to put into each slot is there a quicker way to do this than by doing

    MyArray(0) = 1
    MyArray(1) = 6
    MyArray(2) = 10

    etc,,,

    Is it possible to do something like

    MyArray = (1, 6, 10 etc)

    It would save a lot of screen space for a start !

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    You can use the Array function; the only drawback is that the Array function must be performed on the Variant data type (which is less efficient than the other data types). Here's the code:
    Code:
    Dim MyArray As Variant
        .
        . 
        .
    MyArray = Array(1, 6, 10 ...)
    When you reference MyArray, the low-bound index will be 0, and upper-bound will be # of items - 1.
    "It's cold gin time again ..."

    Check out my website here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width