+ Reply to Thread
Results 1 to 2 of 2

run-time error 13 type mismatch (urgent)

  1. #1
    Registered User
    Join Date
    12-27-2007
    Posts
    2

    run-time error 13 type mismatch (urgent)

    Can anyone help me on this code... i keep getting run-time error 13 type mismatch on pos = InStr(1, Cells(i, 1).Value, "Mismatch", 1). i try many ways to do it but still get the error msg. This piece of code is checking for mismatch word and count for many mismatch the program can find in each cell

    Sub compare()
    Dim endcell As Integer
    Dim startcell
    Dim pos As Integer
    Dim count As Integer
    count = 0
    startcell = 1
    endcell = Range("A" & Rows.count).End(xlUp).Row
    For i = startcell To endcell
    pos = InStr(1, Cells(i, 1).Value, "Mismatch", 1)
    If pos > 0 Then
    count = count + 1
    End If
    pos = 0
    Next i
    Cells(1, 3).Value = count
    End Sub

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    godster84

    Welcome to excelforum

    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ 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