Anyone know how to copy a Range of Cells into an Array?
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Anyone know how to copy a Range of Cells into an Array?

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Is there a command to do it or do I have to loop through the Range adding each cell value to the array one by one?

    Thanks

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,936
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    It's fairly straightforward to assign the cells in a range to an array. It's also a very quick way of working with large amounts of worksheet data.

    Sub GetArray()
    Dim vArray()
    vArray = Range("A1:E10")
    'vArray now contain a 10 x 5 array of values
    'You can work with it and then assign it back to a range - this is much quicker
    'than populating cells one at a time through a loop e.g.

    Range("F1:J10").Value = vArray

    End Sub


    HTH,
    D

  3. #3
    New Member
    Join Date
    Feb 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    I knew there had to be simple way. and this really is simple! Nice one, thanks DK

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com