caranya, buat modul baru dan tekan alt+F11 untuk menghidupkan jendela vb, lalu add modul, ketikkan kode berikut di modulnya :
Function baris(nilai)
snil = Format(Str(nilai), "000000000")
juta = Mid(snil, 1, 3)
ribu = Mid(snil, 4, 3)
satu = Mid(snil, 7, 3)
If juta = "000" Then
jut = ""
Else
ucap = ucapan(juta)
jut = ucap + "juta"
End If
If ribu = "000" Then
rib = ""
Else
ucap = ucapan(ribu)
rib = "seribu"
End If
If satu = "000" Then
sat = ""
Else
ucap = ucapan(satu)
sat = ucap
End If
baris = jut + rib + sat + "rupiah"
End Function
Function ucapan(bilang)
ratusan = Left(bilang, 1)
puluhan = Mid(bilang, 2, 1)
satuan = Right(bilang, 1)
Select Case ratusan
Case Is = ""
sratus = ""
Case Is = "0"
sratus = ""
Case Is = "1"
sratus = "seratus"
Case Is = "2"
sratus = "dua ratus"
Case Is = "3"
sratus = "tiga ratus"
Case "4"
sratus = "empat ratus"
Case "5"
sratus = "lima ratus"
Case "6"
sratus = "enam ratus"
Case "7"
sratus = "tujuh ratus"
Case "8"
sratus = "delapan ratus"
Case "9"
sratus = "sembilan ratus"
End Select
Select Case puluhan
Case ""
spuluh = ""
Case "0"
spuluh = ""
Case "1"
spuluh = ""
Case "2"
spuluh = "dua puluh"
Case "3"
spuluh = "tiga puluh"
Case "4"
spuluh = "empat puluh"
Case "5"
spuluh = "lima puluh"
Case "6"
spuluh = "enam puluh"
Case "7"
spuluh = "tujuh puluh"
Case "8"
spuluh = "delapan puluh"
Case "9"
spuluh = "sembilan puluh"
End Select
If puluhan = "1" Then
Select Case satuan
Case "0"
ssatu = "sepuluh"
Case "1"
ssatu = "sebelas"
Case "2"
ssatu = "dua belas"
Case "3"
ssatu = "tiga belas'"
Case "4"
ssatu = "empat belas"
Case "5"
ssatu = "lima belas"
Case "6"
ssatu = "enam belas"
Case "7"
ssatu = "tujuh belas'"
Case "8"
ssatu = "delapan belas"
Case Is = "9"
ssatu = "sembilan belas"
End Select
Else
Select Case satuan
Case ""
ssatu = ""
Case "0"
ssatu = ""
Case "1"
ssatu = "satu"
Case "2"
ssatu = "dua"
Case "3"
ssatu = "tiga"
Case "4"
ssatu = "empat"
Case "5"
ssatu = "lima"
Case "6"
ssatu = "enam"
Case "7"
ssatu = "tujuh"
Case "8"
ssatu = "delapan"
Case "9"
ssatu = "sembilan"
End Select
End If
ucapan = sratus + spuluh + ssatu
End Function
setelah itu di save as sebagai "excell macro enabled book"
untuk memakainya tinggal ketik =Baris(cell)
kalau yang atas eror bisa di download yang yang ini (thanks to http://izkahubb.wordpress.com)
ReplyDelete