+ Reply to Thread
Results 1 to 7 of 7

can't resolve type mismatch error related to an array

  1. #1
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    can't resolve type mismatch error related to an array

    Please have a look at the below script.
    I am getting "type mismatch" errors for A_array and B_array anywhere where I use these arrays within the for loop and I cannot figure out why.
    Please somebody help.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: can't resolve type mismatch error related to an array

    You should be assigning the A and B arrays after you populate the array variables they contain, not before. Also, unless they are declared elsewhere, you might want to consider declaring some variables.

  3. #3
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: can't resolve type mismatch error related to an array

    if I put the A_array and B_array after the DP type arrays then I get a locked array error.
    And declaring variables for the DP arrays and for the A_array and B_array doesn't make a difference.
    Last edited by dschmitt; 07-02-2018 at 07:10 AM. Reason: error correction

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: can't resolve type mismatch error related to an array

    It really does have a problem - you're trying to loop through uninitialised variables.

    The locked issue is due to your code leaping about from the goto statements. A simple fix for that would be something like this:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: can't resolve type mismatch error related to an array

    I declared variables for the arrays and moved A_array and B_array below the DP type arrays.
    Now I am almost there. I still get an error with B_array at:
    Please Login or Register  to view this content.
    The error says: The array is fixed or temporary locked
    How can I overcome this problem? This is my first time working with arrays.
    I attached an example file with data for this sub

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

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: can't resolve type mismatch error related to an array

    See my last post.

  7. #7
    Valued Forum Contributor
    Join Date
    02-21-2010
    Location
    Tokyo, Japan
    MS-Off Ver
    Excel 2007
    Posts
    502

    Re: can't resolve type mismatch error related to an array

    Yes, thanks. I didn't see you post before I posted mine. Using boolean instead if GoTo solved the problem.
    Thanks for the tip.

    Please Login or Register  to view this content.
    Last edited by dschmitt; 07-02-2018 at 07:57 AM.

+ 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. Type Mismatch Error with Array
    By Microsoft Excel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2014, 02:11 PM
  2. [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
  3. Type mismatch error assigning range to array......
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-11-2012, 06:27 PM
  4. Multi-Level Array Type Mismatch Error
    By CrazyFileMaker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2009, 06:20 PM
  5. 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
  6. 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
  7. 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