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
Bookmarks