+ Reply to Thread
Results 1 to 5 of 5

"The index into the specified collection is out of bounds" error

  1. #1
    Registered User
    Join Date
    03-25-2014
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    14

    "The index into the specified collection is out of bounds" error

    Hello,
    I have a macro which takes in dates with a datepicker, and changes column axis, headers, and text box field values accordingly.
    Upon entering any date in May, 2014... the macro gives me an error:

    Run time error '-2147024809 (80070057)': The index into the specified collection is out of bounds.

    Please Login or Register  to view this content.
    Specific line giving problem is the first one:
    Please Login or Register  to view this content.
    Any way to resolve this?

    Thank you.
    Last edited by kundterra; 05-08-2014 at 01:14 PM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,606

    Re: "The index into the specified collection is out of bounds" error

    You probably do not have that many characters in textframe when so short month name appears. the correction should be based on the length of the whole textrange and relatively to that specific numbers shall be used.

    something similar to:
    Please Login or Register  to view this content.
    Last edited by Kaper; 05-05-2014 at 11:29 AM.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    03-25-2014
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: "The index into the specified collection is out of bounds" error

    Thank you Kaper. I was thinking along the same lines, since May, June and July are the only problematic months, March April return to normalcy.

    The code still returns the same error, but now I have something to work along. I will try to get it sorted out first before asking for help again. Thank you.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,606

    Re: "The index into the specified collection is out of bounds" error

    May be in next step of debugging try to check what is the length for "longnamed" monts
    Please Login or Register  to view this content.
    The other possible source is hardcoded shaperange(1) are you sure you always refere to this one?

  5. #5
    Registered User
    Join Date
    03-25-2014
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: "The index into the specified collection is out of bounds" error

    The length is 51. So I changed the code to:

    Please Login or Register  to view this content.
    The problem persists.

    shaperange(1) would not be a problem since other code works containing:

    Please Login or Register  to view this content.


    Edit:-
    I did not want to bump the thread, hence edited this post.
    The problem is solved now.

    The error was in finetuning the .characters(x,y) value. Each individual month's name has a different string length, hence it should be changed individually.
    Last edited by kundterra; 05-08-2014 at 01:16 PM. Reason: 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. Replies: 4
    Last Post: 08-30-2014, 01:41 PM
  2. [SOLVED] If Not ActiveSheet.Range("A1").Value Like "apple" Then MsgBox "Error"
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-18-2014, 02:16 PM
  3. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  4. why do i get "range out of bounds"
    By blw2002 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-25-2012, 08:23 PM
  5. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM

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