hai,,, Pecinta EXCEL,.,. hari ini saya akan
berbagi bagaimana cara "MENGUBAH ANGKA KE HURUF
PADA EXCEL", saya cerita sebentar dulu ah.. dahulu saya juga
pernah binggung ini bagaimana ya caranya, kok bisa seperi ini??? nah setalah
saya pelajari ternyata caranya mudah makannya saya berbagi kepada anda semua
heheh..
gak perlu lama-lama ato langsung aja deh..
heheh Hal yang perlu Anda lakukan adalah :
BUAT DULU SEPERTI INI
- Buka Excel
- Tekan bareng tombol ALT + F11
- Pilih menu INSERT, klik MODULE
- Kopi kode di bawah (berlatar biru) dan paste ke dalam lembar Modul.
- Tekan bareng tombol ALT + Q
Ini neh baing keladinya hahahha
LIAT PENAMPAKANNYA
Function
toword(ByVal MyNumber)
Dim Temp
Dim Number, Cents
Dim DecimalPlace, Count
ReDim Place(9) As String
' Convert MyNumber to a string,
trimming extra spaces.
MyNumber = Trim(Str(MyNumber))
' Find decimal place.
DecimalPlace = InStr(MyNumber,
".")
' If we find decimal place...
If DecimalPlace > 0 Then
' Convert cents
Temp = Left(Mid(MyNumber,
DecimalPlace + 1) & "00", 2)
Cents = ConvertTens(Temp)
' Strip off cents from remainder to
convert.
MyNumber = Trim(Left(MyNumber,
DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <>
""
' Convert last 3 digits of MyNumber
to English Number.
Temp =
ConvertHundreds(Right(MyNumber, 3))
If Temp <> "" Then
Number = Temp & Place(Count) & Number
If Len(MyNumber) > 3 Then
' Remove last 3 converted digits
from MyNumber.
MyNumber = Left(MyNumber,
Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
' Clean up number.
Select Case Number
Case ""
Number = "Nol"
Case "Satu"
Number = "Satu"
Case Else
Number = Number
End Select
' Clean up cents.
Select Case Cents
Case ""
Cents = " koma Nol"
Case "Satu"
Cents = " koma Satu"
Case Else
Cents = " koma " &
Cents
End Select
toword = Number & Cents
End Function
Private
Function ConvertHundreds(ByVal MyNumber)
Dim Result As
String
' Exit if there is nothing to convert.
If Val(MyNumber) = 0 Then Exit
Function
' Append leading zeros to number.
MyNumber = Right("000" &
MyNumber, 3)
' Do we have a hundreds place digit to
convert?
If Left(MyNumber, 1) <>
"0" Then
Result =
ConvertDigit(Left(MyNumber, 1)) & " Nol "
End If
' Do we have a tens place digit to
convert?
If Mid(MyNumber, 2, 1) <>
"0" Then
Result = Result &
ConvertTens(Mid(MyNumber, 2))
Else
' If not, then convert the ones
place digit.
Result = Result &
ConvertDigit(Mid(MyNumber, 3))
End If
ConvertHundreds = Trim(Result)
End Function
Private
Function ConvertTens(ByVal MyTens)
Dim Result As
String
' Is value between 10 and 19?
If Val(Left(MyTens, 1)) = 1 Then
Select Case Val(MyTens)
Case 10: Result = "Satu
Nol"
Case 11: Result = "Satu
Satu"
Case 12: Result = "Satu
Dua"
Case 13: Result = "Satu
Tiga"
Case 14: Result = "Satu
Empat"
Case 15: Result = "Satu
Lima"
Case 16: Result = "Satu
Enam"
Case 17: Result = "Satu
Tujuh"
Case 18: Result = "Satu
Delapan"
Case 19: Result = "Satu
Sembilan"
Case Else
End Select
Else
' .. otherwise it's between 20 and
99.
Select Case Val(Left(MyTens, 1))
Case 0: Result = "Nol
"
Case 2: Result = "Dua
"
Case 3: Result = "Tiga
"
Case 4: Result = "Empat
"
Case 5: Result = "Lima
"
Case 6: Result = "Enam
"
Case 7: Result = "Tujuh "
Case 8: Result = "Delapan
"
Case 9: Result = "Sembilan
"
Case Else
End Select
' Convert ones place digit.
Result = Result &
ConvertDigit(Right(MyTens, 1))
End If
ConvertTens = Result
End Function
Private
Function ConvertDigit(ByVal MyDigit)
Select Case
Val(MyDigit)
Case 0: ConvertDigit =
"Nol"
Case 1: ConvertDigit =
"Satu"
Case 2: ConvertDigit =
"Dua"
Case 3: ConvertDigit =
"Tiga"
Case 4: ConvertDigit =
"Empat"
Case 5: ConvertDigit =
"Lima"
Case 6: ConvertDigit =
"Enam"
Case 7: ConvertDigit =
"Tujuh"
Case 8: ConvertDigit =
"Delapan"
Case 9: ConvertDigit =
"Sembilan"
Case Else: ConvertDigit =
""
End Select
End Function
PIYE YA
CARA NAMPIL NA, GAK PERLU RIBET CARANYA SEPERTI INI
Ketik : =Toword(B4)
DAN INILAH HASILNYA
TERIMAKASIH SUDAH BERKUNJUNG. jangan lupa tinggalkan pesan atau komennya ya heheh
0 komentar:
Posting Komentar