+ Reply to Thread
Results 1 to 5 of 5

If statement using InStr function using vbTextCompare is giving type 13 mismatch error

  1. #1
    Registered User
    Join Date
    06-29-2012
    Location
    Seattle, WA
    MS-Off Ver
    Mac Office 2011
    Posts
    11

    If statement using InStr function using vbTextCompare is giving type 13 mismatch error

    Hello,

    I'm using a macro to look for any worksheets that have any case of 'rename' in the sheet name, and prompt for user input to change the name. It needs to recognize the word, regardless of uppercase or lowercase. I looked for help on the web, and vbTextCompare seemed to offer a solution. However, I can't get it to work. I'm using the following code:

    Please Login or Register  to view this content.
    Not sure what I'm doing wrong here. The rest of my code works great. If I remove the vbTextCompare, it also works well, but only if 'rename' is all uppercase.
    Any help is appreciated!

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: If statement using InStr function using vbTextCompare is giving type 13 mismatch error

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Can you post the rest of the code?
    If posting code please use code tags, see here.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: If statement using InStr function using vbTextCompare is giving type 13 mismatch error

    You can not omit 1st argument when you specify comparemode
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-29-2012
    Location
    Seattle, WA
    MS-Off Ver
    Mac Office 2011
    Posts
    11

    Re: If statement using InStr function using vbTextCompare is giving type 13 mismatch error

    Thank you! Putting in the first argument solved the problem. In response to Norie, my full code is below. I've made it as clean as I know how to make it without having had any classes on VBA.

    Please Login or Register  to view this content.

+ 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