+ Reply to Thread
Results 1 to 8 of 8

Sudden appearance of Run-time error '13': Type mismatch in previously working code

  1. #1
    Forum Contributor Rhudi's Avatar
    Join Date
    03-08-2013
    Location
    South Carolina, US
    MS-Off Ver
    Professional Plus 2016 aka Office 365
    Posts
    199

    Sudden appearance of Run-time error '13': Type mismatch in previously working code

    This makes no sense at all. I've been using vba code I've been working on for months.
    About an hour ago, I started getting a "Type mismatch" error.
    Either of these lines will throw the error:
    Please Login or Register  to view this content.
    tempArray() is a string and that array contains a router dump file from a 'sh run'. I can expand it and it does have the text for which I am looking.
    My original code was using the t = ... bit and I was doing an "IsError(t)" to test. Once that threw the error, I tried the MsgBox and also get the error.

    wtfo?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Sudden appearance of Run-time error '13': Type mismatch in previously working code

    I don't know what conclusion(s) can be drawn without seeing the data ... and the rest of the code.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor Rhudi's Avatar
    Join Date
    03-08-2013
    Location
    South Carolina, US
    MS-Off Ver
    Professional Plus 2016 aka Office 365
    Posts
    199

    Re: Sudden appearance of Run-time error '13': Type mismatch in previously working code

    Actually, I just accidentally figured it out. Apparently, there is a limit to the size of the text file.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Sudden appearance of Run-time error '13': Type mismatch in previously working code

    OK, thanks for the update. Thanks for the rep.

  5. #5
    Forum Contributor Rhudi's Avatar
    Join Date
    03-08-2013
    Location
    South Carolina, US
    MS-Off Ver
    Professional Plus 2016 aka Office 365
    Posts
    199

    Re: Sudden appearance of Run-time error '13': Type mismatch in previously working code

    Even tho this is marked CLOSED, I'm hoping someone may be able to add one detail...
    What is the maximum number of elements in an array that excel vba can process?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Sudden appearance of Run-time error '13': Type mismatch in previously working code

    Did you Google: What is the maximum number of elements in an array that excel vba can process

    See: http://msdn.microsoft.com/en-us/libr...sedLimitsExcel

    And, as far as I can see, the number of elements is only limited by available memory.

    Regards, TMS

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Sudden appearance of Run-time error '13': Type mismatch in previously working code

    How were you declaring t?

    What do you get for x when you use something like this?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  8. #8
    Forum Contributor Rhudi's Avatar
    Join Date
    03-08-2013
    Location
    South Carolina, US
    MS-Off Ver
    Professional Plus 2016 aka Office 365
    Posts
    199

    Re: Sudden appearance of Run-time error '13': Type mismatch in previously working code

    I got the same run time error, using Filter or Application.Match
    For arrays, I always use "Dim x$()" - I just don't like seeing "Variant" in my variable list.
    the variable 't' is declared as a Variant, as it will either be an integer that matches the line number in my array or an error.
    When I use 't' in that way, the next statement to use that number will be "If Not IsError(t) then ..."
    ---
    TMS's answer is spot on about RAM.
    ---
    The array I'm reading is filled from a text file that contains a Cisco Router "show run" configuration dump.
    However, in the recent problem that I had (caused by myself) I had copied the router data from an internal server that uses software call Rancid. That file was significantly larger as Rancid will prepend all the hardware inventory data that it can figure out from the router.
    What I believe I should do if have some way to query the system to find out how much RAM is available and generate a warning if the array may be too large.
    I suppose that alternatively, I could do an "On Error..." trap right before I try to manipulate that array and if I get RT Error 13, I know it should be because the array is too large.
    ---
    If this is a limitation to the amount of free RAM, I've always said that I need more memory, I just forget why. :P
    Last edited by Rhudi; 08-22-2014 at 11:34 PM.

+ 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. [SOLVED] Sudden "Type mismatch error"
    By EdwardStephenson in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-29-2014, 10:49 AM
  2. [SOLVED] Subscript Error in previously working code.
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2014, 10:59 AM
  3. VBA Code Run-time Error 13 - Type mismatch
    By jmancha in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-16-2013, 11:15 AM
  4. Run Time Error '13'. Type Mismatch
    By TonyforVBA in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-08-2010, 09:29 AM
  5. Run-time error '13' Type mismatch
    By alepag in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-05-2010, 05:50 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