+ Reply to Thread
Results 1 to 5 of 5

type mismatch

  1. #1
    Registered User
    Join Date
    03-29-2010
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    type mismatch

    Hi,

    Why do I get a type mismatch error when this works:

    Please Login or Register  to view this content.
    but this doesnt:

    Please Login or Register  to view this content.
    That is, the form initializes the values ok, but then when I add the code to calculate I get the type mismatch?

    Any thoughts?

    Thanks!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: type mismatch

    Hello umbata,

    My best guess is the UserForm is not displayed as non-modal. When a window is modal, the owner of the window is prevented from receiving input until the modal window is dismissed.

    You can change the modal property of the UserForm by setting the ShowModalproperty to False in the UserForm_Initialize() event.

    Please Login or Register  to view this content.
    If this does not fix your problem then you should post a copy of your workbook for review.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2405
    Posts
    25,057

    Re: type mismatch

    I am not able to reproduce the error. I am not sure how this could produce a type mismatch since a label caption value is a string and Format returns a string. There could be something funny going on in the call to Format. To isolate it, insert these lines of code and see if the error occurs on a Debug.Print line:

    Please Login or Register  to view this content.
    If not then the issue occurs during the assignment, and the results of the Debug.Print (CTRL-g to open the Immediate Window) might show you what is wrong.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,381

    Re: type mismatch

    You would get that error if L11 contained an error value at the time the code runs.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Registered User
    Join Date
    03-29-2010
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: type mismatch

    Romperstomper... you got it! My oversight. Thanks so much.

+ 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 Type error 13 Type Mismatch
    By Affan Khan in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-13-2012, 12:58 PM
  2. [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
  3. [SOLVED] Type Mismatch: array or user defined type expected
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2006, 10:45 AM
  4. [SOLVED] Type mismatch using rnge as Range with Type 8 Input Box
    By STEVE BELL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-03-2005, 01:10 AM
  5. [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