Şöyle çevirir sanırım;Bu kod ondalık sayıları çevirmiyor örnek 101,52
Kod:
Function SayiyiYaziyaCevir(Sayi As Double) As String
Dim Birler() As String
Dim Onlar() As String
Dim Yuzler() As String
Dim Result As String
Dim TamKisim As Long
Dim OndalikKisim As Double
Dim OndalikSayi As Integer
Dim basamak As Integer
Dim On, Yuz As Integer
Birler = Split("Bir,İki,Üç,Dört,Beş,Altı,Yedi,Sekiz,Dokuz", ",")
Onlar = Split("On,Yirmi,Otuz,Kırk,Elli,Altmış,Yetmiş,Seksen,Doksan", ",")
Yuzler = Split("Yüz,İki Yüz,Üç Yüz,Dört Yüz,Beş Yüz,Altı Yüz,Yedi Yüz,Sekiz Yüz,Dokuz Yüz", ",")
TamKisim = Int(Sayi)
OndalikKisim = Sayi - TamKisim
If TamKisim = 0 And OndalikKisim > 0 Then
Result = "Sıfır"
ElseIf TamKisim = 0 Then
Result = "Sıfır"
SayiyiYaziyaCevir = Result
Exit Function
Else
Yuz = Int(TamKisim / 100)
If Yuz > 0 Then
Result = Result & Yuzler(Yuz - 1) & " "
TamKisim = TamKisim - (Yuz * 100)
End If
On = Int(TamKisim / 10)
If On > 0 Then
Result = Result & Onlar(On - 1) & " "
TamKisim = TamKisim - (On * 10)
End If
If TamKisim > 0 Then
Result = Result & Birler(TamKisim - 1)
End If
End If
If OndalikKisim > 0 Then
' Ondalık kısmı 2 basamağa yuvarlayalım
OndalikSayi = Round(OndalikKisim * 100)
If OndalikSayi > 0 Then
Result = Application.Trim(Result) & " Virgül "
On = Int(OndalikSayi / 10)
If On > 0 Then
Result = Result & Onlar(On - 1) & " "
OndalikSayi = OndalikSayi - (On * 10)
End If
If OndalikSayi > 0 Then
Result = Result & Birler(OndalikSayi - 1)
End If
End If
End If
SayiyiYaziyaCevir = Application.Trim(Result)
End Function
Kod:
Function SayiyiParaYaziyaCevir(Sayi As Double) As String
Dim Birler() As String
Dim Onlar() As String
Dim Yuzler() As String
Dim Result As String
Dim TamKisim As Long
Dim OndalikKisim As Double
Dim OndalikSayi As Integer
Dim basamak As Integer
Dim On, Yuz As Integer
Birler = Split("Bir,İki,Üç,Dört,Beş,Altı,Yedi,Sekiz,Dokuz", ",")
Onlar = Split("On,Yirmi,Otuz,Kırk,Elli,Altmış,Yetmiş,Seksen,Doksan", ",")
Yuzler = Split("Yüz,İki Yüz,Üç Yüz,Dört Yüz,Beş Yüz,Altı Yüz,Yedi Yüz,Sekiz Yüz,Dokuz Yüz", ",")
TamKisim = Int(Sayi)
OndalikKisim = Sayi - TamKisim
If TamKisim = 0 Then
Result = "Sıfır"
Else
Yuz = Int(TamKisim / 100)
If Yuz > 0 Then
Result = Result & Yuzler(Yuz - 1) & " "
TamKisim = TamKisim - (Yuz * 100)
End If
On = Int(TamKisim / 10)
If On > 0 Then
Result = Result & Onlar(On - 1) & " "
TamKisim = TamKisim - (On * 10)
End If
If TamKisim > 0 Then
Result = Result & Birler(TamKisim - 1)
End If
End If
If Result <> "" Then
Result = Application.Trim(Result) & " TL"
End If
If OndalikKisim > 0 Then
OndalikSayi = Round(OndalikKisim * 100)
If OndalikSayi > 0 Then
Dim KurusResult As String
On = Int(OndalikSayi / 10)
If On > 0 Then
KurusResult = KurusResult & Onlar(On - 1) & " "
OndalikSayi = OndalikSayi - (On * 10)
End If
If OndalikSayi > 0 Then
KurusResult = KurusResult & Birler(OndalikSayi - 1)
End If
KurusResult = Application.Trim(KurusResult) & " Kr"
If Result <> "" Then
Result = Result & " " & KurusResult
Else
Result = KurusResult
End If
End If
End If
If Result = "" Then
Result = "Sıfır TL"
End If
SayiyiParaYaziyaCevir = Result
End Function
Son düzenleme: