+ Reply to Thread
Results 1 to 3 of 3

Subscript out of range on Array

  1. #1
    Registered User
    Join Date
    09-25-2012
    Location
    Florida, United States
    MS-Off Ver
    Excel 2007
    Posts
    18

    Subscript out of range on Array

    Any of you VB experts think you can help me out here. Not sure why my array is saying subscript is out of range.
    Please Login or Register  to view this content.
    I'm getting a subscript out of range on the 2nd varTotalArray declaration in the inner for loop
    Please Login or Register  to view this content.
    the list should looks something like
    09/25/2012 , 00:00:00, 0
    09/25/2012 , 00:30:00, 0
    09/25/2012 , 01:00:00, 0

    etc.

    suggestions?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Subscript out of range on Array

    You have not allocated enough slots in your array.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    09-25-2012
    Location
    Florida, United States
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Subscript out of range on Array

    (Who switches the thread to solved, me or the admins?)

    Excellent! Thank you for your help Andy. This got the loop to finish

    To verify that the array was working I tried to print it out to the worksheet. The upperbound seemed to end short but I went through the data and the time bins weren't filling in correctly.

    My idea for this loops didn't seem to be working. My goal was to create an array with 3 columns. date, timebin (in 30 minute increments), and count.

    From my math there- this would create 48 time bins per day. 24 hours *2 = 48 (30 minute sections in a day.)

    I used 47 because of index 0 on arrays.

    But then it hit me- here's my working code with print to active selection

    Please Login or Register  to view this content.

+ Reply to Thread

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