+ Reply to Thread
Results 1 to 4 of 4

Type Mismatch problem

  1. #1
    Registered User
    Join Date
    09-14-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2007
    Posts
    45

    Type Mismatch problem

    I am getting a Type Mismatch error on the line ' symbols = Array(ChrW(&H2665), ChrW(&H2666))' I can't fix it. I'd appreciate any advice, please.
    Please Login or Register  to view this content.
    Administrator's note: Please take the time to review our rules. There aren't many, and they are all important. Our guidelines recommend code tags. I have added them for you this time to expedite the thread. --6StringJazzer
    Last edited by 6StringJazzer; 03-17-2024 at 06:45 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Type Mismatch problem

    The Array function returns a Variant, even if all the elements are String. You must declare symbols as Variant. Your code should work with no other changes, however I highly recommend that you declare Symbol. The way you are using it, it must be declared as Variant. It defaults to Variant if you don't declare it, but I strongly recommend to everyone that they use Option Explicit and declare variables. Doing so prevents a lot of bugs and runtime errors.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-14-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Type Mismatch problem

    Quote Originally Posted by 6StringJazzer View Post
    The Array function returns a Variant, even if all the elements are String. You must declare symbols as Variant. Your code should work with no other changes, however I highly recommend that you declare Symbol. The way you are using it, it must be declared as Variant. It defaults to Variant if you don't declare it, but I strongly recommend to everyone that they use Option Explicit and declare variables. Doing so prevents a lot of bugs and runtime errors.
    Thanks Jeff. I appreciate your answer - which solved the problem and your advice. I'll insert the option explicit and [code] tags in the future

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Type Mismatch problem

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

+ 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] Type mismatch problem
    By zoox in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-10-2024, 02:49 PM
  2. Type mismatch problem
    By terrypin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-29-2019, 08:50 AM
  3. [SOLVED] type mismatch problem
    By mira255 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2012, 06:56 AM
  4. type mismatch problem
    By hotmalepiyush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2008, 08:50 AM
  5. Type mismatch problem
    By bernie1961 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2008, 01:20 PM
  6. Type mismatch problem
    By Dan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-31-2006, 12:00 PM
  7. Type Mismatch Problem
    By Damien McBain in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2005, 12: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