+ Reply to Thread
Results 1 to 8 of 8

[Solved] Error 13 - Type Mismatch

  1. #1
    Registered User
    Join Date
    06-06-2019
    Location
    New York
    MS-Off Ver
    2016
    Posts
    6

    [Solved] Error 13 - Type Mismatch

    Hello,
    I'm trying to run this code, which works perfectly on one file, but is giving a type mismatch on another file I'm trying to use it on.

    The issue happens on the following line:

    index = Mid(FSMnumber, 3)

    Any ideas? I can't figure out why it only works on certain sheets.
    Thanks!
    Tim

    Please Login or Register  to view this content.
    Last edited by timefend; 06-06-2019 at 11:28 PM.

  2. #2
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Error 13 - Type Mismatch

    that is cause mid takes more arguments, you have:
    Please Login or Register  to view this content.
    when it should be something like:
    Please Login or Register  to view this content.
    Mid(string, start, [ length ])

    let me know if that helps

  3. #3
    Registered User
    Join Date
    06-04-2019
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    48

    Re: Error 13 - Type Mismatch

    Mr. timefend,

    Good morning sir!! Just wanted to inform you that you should put your code in a code block instead of a quote block as it would be much easier to read. You can use [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] in order to achieve this. Thank you!!

    Dome

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Error 13 - Type Mismatch

    @dmcgov
    You do not need to specify the length when using the VBA function Mid.

    @timefend
    What is the value of FSMnumber when you get the error?

    Also as mentioned by BrokenDome, you need to edit you post to include code tags, rather than Quote tags

  5. #5
    Registered User
    Join Date
    06-06-2019
    Location
    New York
    MS-Off Ver
    2016
    Posts
    6

    Re: Error 13 - Type Mismatch

    Thanks guys - changed the quote tags.

    Fluff13 - The value of FSMnumber when I run the code is "X6", which contains a formula referencing another cell with a numerical value.

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Error 13 - Type Mismatch

    This
    Please Login or Register  to view this content.
    is trying to return the contents of FSMnumber starting at the third character.
    But as it only contains X6, there is no third character, hence the error.

  7. #7
    Registered User
    Join Date
    06-06-2019
    Location
    New York
    MS-Off Ver
    2016
    Posts
    6

    Re: Error 13 - Type Mismatch

    Thank you!

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: [Solved] Error 13 - Type Mismatch

    You're welcome & thanks for the feedback

+ 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] RunTime Error 13 ( type mismatch ) error is comming TextboxAfter_Update
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2017, 03:55 AM
  2. Type mismatch error
    By saahilnagrani in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2015, 02:40 AM
  3. Run Type error 13 Type Mismatch
    By Affan Khan in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-13-2012, 12:58 PM
  4. [SOLVED] Run-type error 13 type mismatch
    By misop in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-05-2012, 04:08 AM
  5. Complile Error: Type Mismatch ??? After adding error trap
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2012, 03:50 PM
  6. Conditional Formatting - Run Time Error '13' Type Mismatch Error
    By ksp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-17-2011, 07:37 PM
  7. [SOLVED] Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05: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