+ Reply to Thread
Results 1 to 3 of 3

Mismatch error

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Mismatch error

    When I click on the 'Validate' button, the code should look at the value in column A (the "ReturnValue" as String) and compare it to the list of valid values in Myarr (values of the Variant type). If a match is found, all is good and the code moves on to the next cell in column A (Next i). If a match is NOT found, I want to change the font color of the value in column A.

    When I look at Myarr in the Watch Window I can see the values are set to Variant/String.

    So why am I getting a mismatch error? How do I fix this?

    My worksbook is also attached.

    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Mismatch error

    You cannot compare a value against an array like that, one option would be to use
    Please Login or Register  to view this content.
    Although if you have a lot of values to compare you'd bet better off using a dictionary.

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

    Re: Mismatch error

    With a dictionary
    Please Login or Register  to view this content.

+ 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. Getting error message- Run-time error '13'; type mismatch
    By UPA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2017, 03:43 AM
  2. [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
  3. Type mismatch error- What is the reason behind the error message?
    By Endre111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2014, 02:03 PM
  4. [SOLVED] run-time error '13' Type Mismatch error
    By Blake 7 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-16-2012, 08:59 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. Type Mismatch error & subscript out of range error
    By Jeff Wright in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2005, 03:06 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