Find Mismatch Characters:

 Here is a code to highlight the misspelled characters in two Text paragraphs

suppose you have data like this table, and you want to highlight the misspelled characters , you can use given code 


Sub HighlightWrongCharacters()
    Dim bytFirstWord()  As Byte
    Dim bytSecondWord() As Byte
    Dim VarArrData
    Dim lngCOunt        As Long
    Dim lngCOunt2       As Long
    Dim rngRange        As Range
    Dim lngCharIndex    As Long
    Set rngRange = Range(“A1”).CurrentRegion
    VarArrData = rngRange
    For lngCOunt = LBound(VarArrData) To UBound(VarArrData)
        bytFirstWord = VarArrData(lngCOunt, 1)
        bytSecondWord = VarArrData(lngCOunt, 2)
        If UBound(bytFirstWord) = UBound(bytSecondWord) Then
            For lngCOunt2 = LBound(bytFirstWord) To UBound(bytFirstWord)
                If bytSecondWord(lngCOunt2) <> 0 Then lngCharIndex = lngCharIndex + 1
                If bytFirstWord(lngCOunt2) <> bytSecondWord(lngCOunt2) Then
                    rngRange.Cells(lngCOunt, 1).Characters(lngCharIndex, 1).Font.Color = vbRed
                    rngRange.Cells(lngCOunt, 2).Characters(lngCharIndex, 1).Font.Color = vbRed
                End If
        End If
        lngCharIndex = 0
    Next lngCOunt
End Sub
Sub MakeAutomatic()
    Range(“A1”).CurrentRegion.Font.Color = vbBlack
End Sub
Click here to download .xlsm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s