TOP

Transliteration from Ukrainian to English

YouLibreCalc for Excel logo

Description

If you often have to translate Cyrillic into translit, then this function is for you.


VBA code for the TRANSLIT function

Open the editor Visual Basic (Alt + F11), insert a new empty software module (Insert - Module) and copy the text of this function there:

Function Translit(Txt As String) As String
 	'moonexcel.com.ua
    Dim UkrChrList As Variant
    Dim EngChrList As Variant
    
    UkrChrList = Array("а", "б", "в", "г", "ґ", "д", "е", "є", "ж", "з", "і", "ї", "й", _
    "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", _
    "щ", "и", "ь", "ю", "я", "А", "Б", "В", "Г", "Ґ", "Д", "Е", _
    "Є", "Ж", "З", "И", "Ї", "Й", "К", "Л", "М", "Н", "О", "П", "Р", _
    "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "И", "Ь", "Ю", "Я", " ", "'", "’")
    
    EngChrList = Array("a", "b", "v", "h", "g", "d", "e", "ie", "zh", "z", "i", "i", "i", _
    "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "f", "kh", "ts", "ch", "sh", _
    "shch", "y", "", "iu", "ia", "A", "B", "V", "H", "G", "D", "E", _
    "Ie", "Zh", "Z", "I", "I", "I", "K", "L", "M", "N", "O", "P", "R", _
    "S", "T", "U", "F", "Kh", "Ts", "Ch", "Sh", "Shch", "Y", "", "Iu", "Ia", " ", "", "")
    
    For i = 1 To Len(Txt)
        ukrChr = Mid(Txt, i, 1)
        flag = 0
        
        For j = 0 To 65
            If UkrChrList(j) = ukrChr Then
                engChr = EngChrList(j)
                flag = 1
                Exit For
            End If
        Next j
        
        If flag Then result = result & engChr Else result = result & ukrChr
    Next i
    
    Translit = result
End Function

Now on any sheet of this book you can use this function by inserting it through the menu Insert - Function , category User defined (User defined) :

Related Articles: