Results 1 to 9 of 9

Named Range to Array

Threaded View

  1. #1
    Registered User
    Join Date
    01-01-2005
    MS-Off Ver
    2007
    Posts
    368

    Named Range to Array

    Hi,

    I am trying to populate one dimensional array with a named range. The named range "Names" refers to just one column. When I run the code below, I get a 2 dimensional array, why?

    Sub RangeToArray()
        Dim cnt As Byte
        Dim rngNames As Range
        Dim arrNames As Variant
    
        cnt = ActiveSheet.Range("Names").Count
        Set rngNames = ActiveSheet.Range("Names")
            
        ReDim arrNames(cnt - 1)
        arrNames = rngNames
    End Sub
    What do I have to change to make it work?

    Regards,
    Elio fernandes
    Last edited by efernandes67; 09-21-2011 at 11:48 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1