It is often necessary to encounter Latin (English) letters in a text written in Cyrillic (Ukrainian or Russian). This often happens during the analysis and processing of text information from databases, where, in turn, text was entered by operators who did not have time to switch to a new keyboard layout.
So we need a mechanism how find the Cyrillic alphabet in the Latin alphabet or, conversely, find Latin in Cyrillic . Excel has no standard tools for such purposes. Below you will find a ready-made macro on VBA , which carries out search for Latin letters in the text , written in Cyrillic and vice versa.
You must add the VBA code to your workbook before using this macro. For this:
Now you can select a range of cells, run a macro, and thus check the text for foreign characters.
Macro code for searching Latin letters:
Sub ShowLatin() 'moonexcel.com.ua Dim c As Range, i As Long For Each c In Selection For i = 1 To Len(c) If Mid$(c, i, 1) Like "[A-Za-z]" Then c.Characters(Start:=i, Length:=1).Font.ColorIndex = 3 Next i, c End Sub
The result of checking the text in Latin:
Macro code for searching Cyrillic letters:
Sub ShowCyrylic() 'moonexcel.com.ua Dim c As Range, i As Long For Each c In Selection For i = 1 To Len(c) If Mid$(c, i, 1) Like "[А-Яа-яЁЄЇІҐёєїіґ]" Then c.Characters(Start:=i, Length:=1).Font.ColorIndex = 3 Next i, c End Sub
The result of checking the Cyrillic text: