الاخ الاستاذ / محمد
الكود السابق تظهر كلمات اللغة العربية بشكل مختلف
اليك الكود صحيحا
Function RANKING(X_Mar As Range, Cer_Range As Range, True_False As Boolean)
Application.ScreenUpdating = False
Dim Arr1, Arr2, Arr3
Dim RNK, ss As Integer
Dim TEXT_M As String
Dim TRT
Arr1 = Array("", "الأول", "الثاني", "الثالث", "الرابع", "الخامس", "السادس", "السابع", "الثامن", "التاسع", "العاشر")
Arr2 = Array(" ", "عشر", "العشرون", "الثلاثون", "الاربعون", "الخمسون", "الستون", "السبعون", "الثمانون", "التسعون")
Arr3 = Array(" ", "المائة", "المائتنان", "الثلاثمائة", "الاربعمائة", "الخمسمائة", "الستمائة", "السبعمائة", "الثمانمائة", "التسعمائة")
RNK = X_Mar
RNK = WorksheetFunction.Rank(X_Mar, Cer_Range, 0)
If True_False = True Then RNK = X_Mar
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Set MRange = Range(Cells(3, X_Mar.Column), Cells(X_Mar.Row - 1, X_Mar.Column))
If WorksheetFunction.CountIf(Cer_Range, X_Mar) <> 1 And WorksheetFunction.CountIf(MRange, X_Mar) >= 1 Then TEXT_M = " مكرر "
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
X1 = Right(RNK, 1): X2 = Left(RNK, 1): X3 = Left(RNK, 1)
If Len(RNK) = 3 Then X2 = Left(Mid(RNK, 2), 1)
'................................
TRT = Arr1(X1) & " و" & Arr2(X2)
If X1 = 0 Then TRT = Arr2(X2)
If X1 = 1 Then TRT = "الحادي و" & Arr2(X2)
If X2 = 1 Then
TRT = Arr1(X1) & " " & Arr2(X2)
If X1 = 0 Then TRT = " العاشر "
If X1 = 1 Then TRT = " الحادي عشر "
End If
'................................
If Len(RNK) = 1 Then RANKING = Arr1(X1) & TEXT_M
If Len(RNK) = 2 Then RANKING = TRT & TEXT_M
If Len(RNK) = 3 Then RANKING = TRT & " بعد " & Arr3(X3) & TEXT_M
If Len(RNK) = 3 And X2 = 0 Then RANKING = Arr1(X1) & " بعد " & Arr3(X3) & TEXT_M
If Len(RNK) = 3 And X1 = 0 And X2 = 0 Then RANKING = Arr3(X3) & TEXT_M
If RNK = 1000 Then RANKING = "الآلــف" & TEXT_M
Application.ScreenUpdating = True
End Function