+ Reply to Thread
Results 1 to 12 of 12

Loading Array: Range vs. Loop

  1. #1
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Loading Array: Range vs. Loop

    Question.

    If I load an sheet into an array, lets say 1000 rows 20 columns, can I not then load individual items from that array into another array, let's say a 1 dimensional array?

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Loading Array: Range vs. Loop

    yes you can. have you had a problem with it?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Loading Array: Range vs. Loop

    Yes. I cannot figure out how to do this, keep getting error

    I'd like to be able to load the entire array in one shot and then loop through that array for select items?

    Can this be done, I have not been able to get this to work and have been told that I can only loop through both times, help and clarification?
    Last edited by cmore; 10-10-2013 at 02:08 PM.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Loading Array: Range vs. Loop

    Please Login or Register  to view this content.
    for instance

  5. #5
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Loading Array: Range vs. Loop

    Yeah, this is what I try and always get an error. I will try one more time and then post code. Maybe I've been just jacking things up.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Loading Array: Range vs. Loop

    What is the name of the error? Is it "Out script"?

  7. #7
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Loading Array: Range vs. Loop

    I think I can't remember if it's the out of script or the 1004. I'll try soon and post just need to step away for a moment. I'm looking at your example and that's exactly what I write, except into 1-D arrays, so we shall see. I assume I'm doing something dumb.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Loading Array: Range vs. Loop

    cmore,
    The code was written by Jay, not me.

  9. #9
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Loading Array: Range vs. Loop

    Sorry about that, but yes I am getting the out of range error. I'm just trying to load a 1-D array. Code Below:

    Please Login or Register  to view this content.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,284

    Re: Loading Array: Range vs. Loop

    An array that is loaded from a range will have lower bound of 1, rather than 0. Your code is failing trying to access column 0. You need to adjust your indices.
    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  11. #11
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Loading Array: Range vs. Loop

    Dagg, I knew it'd be something the opposite of smart. Thank You. How do I mark this SOLVED!

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,284

    Re: Loading Array: Range vs. Loop

    Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

+ 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. VBA Arrays: Loading with Range vs Loop and selecting data given Criteria
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-17-2013, 10:30 PM
  2. Loop Array values Through a Range and Hide Rows if a Match
    By therzakid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-29-2011, 01:04 PM
  3. Loading an array with non-consecutive columns
    By Phil_V in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2009, 09:08 AM
  4. Loading Worksheet Range to VBA Array
    By JohanF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2007, 06:54 AM
  5. Loading array into list box
    By r wilcox in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-20-2005, 07:05 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