+ Reply to Thread
Results 1 to 5 of 5

incompatible types

  1. #1
    Registered User
    Join Date
    02-13-2013
    Location
    Maringá, Paraná, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    10

    Unhappy incompatible types

    Hi,
    I have the following program:

    Please Login or Register  to view this content.
    But, to reach the highlighted line generates compile error 13 - incompatible types. The return of instr is an integer type, but stated (aux1, aux2, aux3) as variant, string and long and still generated error. Could anyone help me?

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

    Re: incompatible types

    The problem is that you've only used 3 arguments of InStr.

    If you are going to use the last argument Compare you need to use the first argument Start.

    Start requires an integer.

    Either remove the ,1 at the end or add 1, at the start.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-13-2013
    Location
    Maringá, Paraná, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: incompatible types

    Ok! Worked! Thanks!!

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: incompatible types

    Might also be useful being explicit in your declarations, in the below, only layermm is a string:
    Please Login or Register  to view this content.
    The above is the same as:
    Please Login or Register  to view this content.
    VBA unfortunately requires that you do the below:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-13-2013
    Location
    Maringá, Paraná, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: incompatible types

    Ok! Thank´s, now i understand!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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