+ Reply to Thread
Results 1 to 7 of 7

Type Mismatch causing me issues

  1. #1
    Registered User
    Join Date
    06-07-2016
    Location
    Great White North
    MS-Off Ver
    Office 365
    Posts
    10

    Type Mismatch causing me issues

    Please Login or Register  to view this content.
    What I'm trying to get done is to force the user to select a number. If they exit the input box, then nothing happens. If they enter anything other than a number, they get the "insert number" message box.

    Works until I enter a non-numerical character. Then it returns the type mismatch error. Help.
    Last edited by lediable007; 06-11-2016 at 09:59 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,684

    Re: Type Mismatch causing me issues

    In this line of code

    Please Login or Register  to view this content.
    Remove the square bracket after the 2
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    06-07-2016
    Location
    Great White North
    MS-Off Ver
    Office 365
    Posts
    10

    Re: Type Mismatch causing me issues

    Quote Originally Posted by alansidman View Post
    In this line of code

    Please Login or Register  to view this content.
    Remove the square bracket after the 2
    Thanks for responding so quickly, Alan.

    Done. Same issue. If I enter anything other than a number, it throws me the type mismatch error.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,684

    Re: Type Mismatch causing me issues

    That is because you have defined myNum as an integer. Try changing it to a Variant and see if that solves your issue.

  5. #5
    Registered User
    Join Date
    06-07-2016
    Location
    Great White North
    MS-Off Ver
    Office 365
    Posts
    10

    Re: Type Mismatch causing me issues

    Quote Originally Posted by alansidman View Post
    That is because you have defined myNum as an integer. Try changing it to a Variant and see if that solves your issue.
    That was the issue. Thanks much, Alan. Threw you some rep!

    LD

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Type Mismatch causing me issues

    Let Excel do the number/string validation, by setting the Type argument.

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Registered User
    Join Date
    06-07-2016
    Location
    Great White North
    MS-Off Ver
    Office 365
    Posts
    10

    Re: Type Mismatch causing me issues

    Quote Originally Posted by mikerickson View Post
    Let Excel do the number/string validation, by setting the Type argument.

    Please Login or Register  to view this content.
    That also works well. Thanks, Mike! Threw you some rep too.

+ 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. Excel to Outlook Calendar date duplication issues and blank cells causing issues
    By singerbatfink in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2016, 08:07 AM
  2. [SOLVED] Excel to Outlook Calendar date duplication issues and blank cells causing issues
    By singerbatfink in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 02-11-2016, 07:57 AM
  3. Runsheet with Macro Issues (Run-time Error '13': Type Mismatch)
    By Ms.Pac-Man in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2014, 06:43 PM
  4. [SOLVED] Using Range.clearcontents causing type mismatch error in code
    By Captian LDS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2014, 04:54 PM
  5. [SOLVED] #Value in array causing Type Mismatch in comparision
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2013, 01:40 PM
  6. [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