`Sub REPCHAR()
Dim Massive(2), DATA As Variant, RES As Variant, LC As String, I As Long, N As Long
Dim Dic: Set Dic = CreateObject("Scripting.Dictionary")
With Sheets("1")
LC = .Cells(.Rows.Count, "D").End(xlUp).Row
DATA = .Range("D1:E" & LC).Value
RES = .Range("D1:E" & LC).Value
For I = 1 To 2
If Not Dic.Exists(DATA(I, 2)) Then
Massive(2) = Replace(DATA(I, 2), "A", "А")
Massive(2) = Replace(DATA(I, 2), "B", "В")
Massive(2) = Replace(DATA(I, 2), "E", "Е")
Massive(2) = Replace(DATA(I, 2), "K", "К")
Massive(2) = Replace(DATA(I, 2), "M", "М")
Massive(2) = Replace(DATA(I, 2), "H", "Н")
Massive(2) = Replace(DATA(I, 2), "O", "О")
Massive(2) = Replace(DATA(I, 2), "P", "Р")
Massive(2) = Replace(DATA(I, 2), "C", "С")
Massive(2) = Replace(DATA(I, 2), "X", "Х")
Massive(2) = Replace(DATA(I, 2), "T", "Т")
Dic(DATA(I, 2)) = Massive
End If
Next I
For N = 1 To UBound(DATA)
On Error Resume Next
RES(N, 1) = Dic(DATA(N, 2))(2)
On Error GoTo 0
Next N
.Range("D1:E" & LC) = RES
End With
End Sub`
你好,
我需要一个宏来将拉丁字母替换为类似的西里尔字母。 该宏仅替换一个字母。如何编辑和替换所有 11 个字母。我不擅长数组。如有任何帮助,我们将不胜感激。
尝试
Dic(DATA(I, 2)) = _
Replace(Replace(Replace(Replace(Replace(Replace _
(Replace(Replace(Replace(Replace(Replace( _
DATA(I, 2) _
, "A", "А"), "B", "В"), "E", "Е"), "K", "К"), "M", "М"), "H", "Н") _
, "O", "О"), "P", "Р"), "C", "С"), "X", "Х"), "T", "Т")