+ Reply to Thread
Results 1 to 10 of 10

Type mismatch (Error 13)

  1. #1
    Registered User
    Join Date
    02-14-2018
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    10

    Question Type mismatch (Error 13)

    Hi Guys,

    I have the problems with this code:

    I want if you select in the excelspace (combo) the text "Uitplakprofiel Z-vormig", i want that the variable omlijstingdikte changes to 6.
    I need this 6 to make further calculations. I Took dim as variant because i work with a range of cells and variant can act like an array.
    When i run the program, i get always the same error: Type mismatch (Error 13)
    The problem is situated at If omlijsting = "Uitplakprofiel Z-vormig" Then excel said.

    Can somebody clear this out please? because i struggle with it in another module also.



    Please Login or Register  to view this content.


    Sorry for the bad English

    Thanks in advance
    Attached Files Attached Files
    Last edited by JDM-007; 02-21-2018 at 07:31 AM.

  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: Type mismatch (Error 13)

    Welcome to the board.

    Please take a few minutes to read the Forum Rules, and then edit your post to wrap your code with CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    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: Type mismatch (Error 13)

    Thanks for the code tags.

    In this statement,

    Please Login or Register  to view this content.
    omlijsting is a 2D array; you can't compare it to a single value.

  4. #4
    Registered User
    Join Date
    02-14-2018
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    10

    Re: Type mismatch (Error 13)

    Hi,

    thanks for the feedback but i 'm a newbie to vba so i understand that this are different types of value. But what is a good workaround/workflow to deal with it?

    Thanks in advance

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

    Re: Type mismatch (Error 13)

    O17:Q17 is merged, which means only O17 actually has a value, so try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Type mismatch (Error 13)

    Q17 is partof a merged cell so it has to be O17 instead of Q17.

    PS My apologies Norie, should have pressed F5 before posting.
    Last edited by bakerman2; 02-21-2018 at 12:27 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Registered User
    Join Date
    02-14-2018
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    10

    Question Re: Type mismatch (Error 13)

    Hi,

    That works fine thanks for it. I change this also in module 2 (also merged cells).

    Please Login or Register  to view this content.

    Now the problem is i want to use the value 6 (because omlijstingdikte=6) that i became at module 3 (Sub omlijsting_check()) in the calculation at module 2
    for deurbladhoogte = hoogte_gat - omlijstingdikte - houtdikte - speling_deurVSkassement - speling_onder_deur.

    Can somebody tell what's the best approach?

    Thanks in advance
    Attached Files Attached Files

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Type mismatch (Error 13)

    Your Module3 would look like this.Option Explicit
    Please Login or Register  to view this content.
    Your Module2 like this
    Please Login or Register  to view this content.
    Also it's not very wise to declare all variables as Variant because they are the most memory consuming.

  9. #9
    Registered User
    Join Date
    02-14-2018
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    10

    Re: Type mismatch (Error 13)

    Hi,

    thanks, i change the variabletypes.

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Type mismatch (Error 13)

    Glad to help and thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. 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
  3. [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
  4. 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
  5. 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
  6. [SOLVED] re: Type Mismatch Error
    By Nicole Seibert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2006, 09:45 AM
  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