+ Reply to Thread
Results 1 to 4 of 4

Byref argument type mismatch

  1. #1
    Registered User
    Join Date
    02-03-2012
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    23

    Byref argument type mismatch

    I get "Byref argument type mismatch" error in the following code. Don't know how to fix it.

    Please Login or Register  to view this content.
    I get the error in the EF(i) format.

    Also, changing the Emm and Ef declaration as Double
    Please Login or Register  to view this content.
    i get "Type mismatch: array or user-defined type expected" error.
    Last edited by ref; 02-16-2012 at 06:02 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Byref argument type mismatch

    you declare the array EF as variant and then try to pass it to the function Emissions which is expecting a double.
    So convert the argument when passing it.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    02-03-2012
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Byref argument type mismatch

    Quote Originally Posted by Andy Pope View Post
    you declare the array EF as variant and then try to pass it to the function Emissions which is expecting a double.
    So convert the argument when passing it.

    Please Login or Register  to view this content.
    Thx Andy, it worked.

  4. #4
    Forum Contributor
    Join Date
    02-08-2012
    Location
    South Suffolk
    MS-Off Ver
    Excel 2007
    Posts
    102

    Re: Byref argument type mismatch

    CDbl trys to convert other data types to a double but some values will fail. For example "1.234" and "1,234" will convert but "1x234" will fail with error code 13, Type mismatch.
    VBA does a lot of automatic type convertions (e.g. long to double) making the right-hand side of the equation the type needed for the left-hand side. There are 11 explicit type conversion functions listed in Excel help.
    Kind regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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