Sub המרה()
start:
With Selection.Find
.ClearFormatting
.Execute findText:="[0-9]{1,}", MatchWildcards:=True, Format:=False, Wrap:=wdFindContinue
If .Found = True Then
S = ""
MyArray = Array(400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
MyaArray = Array("ת", "ש", "ר", "ק", "צ", "פ", "ע", "ס", "נ", "מ", "ל", "כ", _
"י", "ט", "ח", "ז", "ו", "ה", "ד", "ג", "ב", "א")
V = Val(Selection)
Do While V > 0
If V = 15 Or V = 16 Then
S = S & "ט"
V = V - 9
End If
For i = 0 To UBound(MyArray)
If V >= MyArray(i) Then
S = S & MyaArray(i)
V = V - MyArray(i)
Exit For
End If
Next i
Loop
If S = "רצח" Then S = "רחצ"
If Len(S) = 1 Then
S = S & "'"
Else
S = Left(S, (Len(S) - 1)) & Chr(34) & Right(S, 1)
End If
Selection = S
GoTo start
End If
End With
End Sub