+ Reply to Thread
Results 1 to 7 of 7

Subscript out of range (error 9)

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Subscript out of range (error 9)

    Someday, I’d love to be able to “help” someone else on the forum, but when one is this inexperienced one answer almost immediately leads to the next question, so… What is causing my subscript out of range (error 9) at line 82? I created the first UDT array element at line 56 and am trying to re-dimension with redim preserve to load the rest of the array.

    Please Login or Register  to view this content.
    Example.xlsm
    Last edited by jdfjab; 06-06-2012 at 05:09 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Subscript out of range (error 9)

    See Help for the proper syntax of the ReDim statement.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Subscript out of range (error 9)

    Shg,

    I tried this after reading through the help, but guess I'm not understanding it as I still get the same error.

    Please Login or Register  to view this content.
    Does it have to do with there being the two different data types in my UDT?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Subscript out of range (error 9)

    Help has its share of problems, but it's still an invaluable resource and you need to learn to use it.
    ReDim [Preserve] varname(subscripts) [As type] [, varname(subscripts) [As type]] . . .

    The ReDim statement syntax has these parts:

    Preserve Optional. Keyword used to preserve the data in an existing array when you change the size of the last dimension.

    varname Required. Name of the variable; follows standard variable naming conventions.

    subscripts Required. Dimensions of an array variable; up to 60 multiple dimensions may be declared. The subscripts argument uses the following syntax: [lower To] upper [,[lower To] upper] . . .
    Last edited by shg; 06-06-2012 at 04:56 PM.

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

    Re: Subscript out of range (error 9)

    if you need a hint
    Please Login or Register  to view this content.
    is not the same as
    Please Login or Register  to view this content.
    the first is a two dimensional array.
    Josie

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

  6. #6
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Subscript out of range (error 9)

    Thanks Shg,

    This worked:

    Please Login or Register  to view this content.
    It's sometimes difficult for us newbies to read "tech-nise".
    Thanks for pointing it out in the "help".

  7. #7
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Subscript out of range (error 9)

    Thanks JP,
    It took a long stare at the help

+ 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