+ Reply to Thread
Results 1 to 8 of 8

"Subscript out of range" error in my VBA codde

  1. #1
    Registered User
    Join Date
    07-25-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    4

    "Subscript out of range" error in my VBA codde

    Hi
    I am using the Vlookup function with worksheetfunctions in VBA but i am getting the "Subscript out of range error"
    Please Login or Register  to view this content.
    Please help
    Last edited by letmeexcel; 09-20-2016 at 04:25 AM. Reason: [CODE]

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: "Subscript out of range" error in my VBA codde

    Hi,

    That error can only mean that the name of the ListObject is not DataTable123.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    07-25-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    4

    Re: "Subscript out of range" error in my VBA codde

    Hi

    The name is correct. I checked that.

    Basically i want to use the table "DataTable123" as the table_array argument of the VLOOKUP function. But i am not able to

    Is there any other way? For trying purpose, i put the argument as Range("A2:D63") but still couldn't get through

    Thanks

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: "Subscript out of range" error in my VBA codde

    For a subscript out of range error to occur that name is not the name of a ListObject on the worksheet whose codename is Sheet1. There is no other possible cause.

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: "Subscript out of range" error in my VBA codde

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  6. #6
    Registered User
    Join Date
    07-25-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    4

    Re: "Subscript out of range" error in my VBA codde

    Please Login or Register  to view this content.
    Used this and i get a 'Type Mismatch" error now.
    Last edited by letmeexcel; 09-20-2016 at 04:27 AM.

  7. #7
    Registered User
    Join Date
    07-25-2016
    Location
    India
    MS-Off Ver
    2016
    Posts
    4

    Re: "Subscript out of range" error in my VBA codde

    Please Login or Register  to view this content.
    Used this and i get a 'Type Mismatch" error now.
    Last edited by zbor; 09-20-2016 at 04:28 AM. Reason: Code tags

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: "Subscript out of range" error in my VBA codde

    That means that the returned value is not a number. Either the lookup cell contains something that cannot be converted to a number, or the lookup value cannot be found and the function is returning an error value.

+ 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. "Run-time error '9': Subscript out of range" when referencing between workbooks
    By roberts23 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2014, 10:33 AM
  2. Breaking out Comma Delimited Fields - VBA Error - "Subscript out of Range"
    By sev979 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2014, 09:55 AM
  3. Error "Subscript out of range", cant seem to find where code is wrong
    By KeithMale in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-14-2013, 07:07 PM
  4. [SOLVED] trying to understand why a code is not working "error 9 subscript out off range"
    By cdafonseca in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-09-2013, 12:33 PM
  5. Error msgs: "Object varible or with block variable not set"; "subscript out of range"
    By menyanthe in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-26-2009, 04:58 PM
  6. [SOLVED] "Subscript out of range" error for: Workbooks("Test1.xls").Save
    By Just12341234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2005, 11:05 AM
  7. [SOLVED] FileCopy Command Giving "Subscript Out of Range" Error Message
    By Jim Hagan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2005, 02: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