+ Reply to Thread
Results 1 to 6 of 6

Type Mismatch Error with Array

  1. #1
    Registered User
    Join Date
    05-26-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    10

    Type Mismatch Error with Array

    Hello,

    I seem to have a problem with using a variable to assign a value to a specific position in an array. When running the code, a type mismatch error appears and I am not sure how to fix this. I would appreciate if you could inform me how I could solve this problem as I am new to visual basic.

    Please Login or Register  to view this content.
    Thank you in advance.

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

    Re: Type Mismatch Error with Array

    The posted code works fine for me provided I enter a value between 0 and 24 in the inputbox.

    Is that all the code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-26-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Type Mismatch Error with Array

    This is the rest of the code:

    Please Login or Register  to view this content.

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

    Re: Type Mismatch Error with Array

    In your If statements you need to repeat arr_position(x).

    I'm not sure about the 2nd set of If statements but this is what the 1st set should look like.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-26-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Type Mismatch Error with Array

    I implemented this into the code and it worked. I then did the same for the 2nd If statement, as shown below:

    Please Login or Register  to view this content.
    Thank you so much!

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

    Re: Type Mismatch Error with Array

    No problem.

    I would have posted a fix for the 2nd set but wasn't sure what you were trying to do.

+ 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 error when trying to populate array
    By neek13 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-21-2013, 03:35 PM
  2. Multi-Level Array Type Mismatch Error
    By CrazyFileMaker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2009, 06:20 PM
  3. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-09-2005, 01:54 AM
  4. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2005, 12:30 AM
  5. 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