+ Reply to Thread
Results 1 to 3 of 3

Assigning a range to an array

Hybrid View

brucemc777 Assigning a range to an array 07-25-2014, 11:27 AM
romperstomper Re: Assigning a range to an... 07-25-2014, 11:29 AM
brucemc777 Re: Assigning a range to an... 07-25-2014, 12:55 PM
  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    615

    Assigning a range to an array

    WHY does
    Dim arStudents() As Variant
    Worksheets("George").Select
    arStudents = Range("B2:B17")
    work, but

    Dim arStudents() As Variant
    
    arStudents = Worksheets("George").Range("B2:B17")
    does not???

    THANK-YOU ALL for your continuing help!

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,016

    Re: Assigning a range to an array

    Due to the level of indirection, you either need:
    arStudents = Worksheets("George").Range("B2:B17").Value
    or:
    Dim arStudents as Variant
    You should always specify .Value or .Value2 anyway.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    615

    Re: Assigning a range to an array

    Thank-you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. help assigning elements of dictionary to array and then pasting array into worksheet
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-05-2013, 10:37 AM
  2. [SOLVED] Assigning a 2D Array to a bigger size range results in "#N/A" in the uncovered elements
    By TopXorGuy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 10:45 AM
  3. [SOLVED] Assigning Range to Array - one way works, the other doesn't
    By Jim-1st in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2012, 03:01 PM
  4. Type mismatch error assigning range to array......
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-11-2012, 06:27 PM
  5. Assigning values into array using the "Array" vba function.......not working
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2011, 04:21 PM

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