sedikit parmasalahan tetapi tidak dikatakan dengan jelas, bisa menyebabkan
BANYAK PERMASALAHAN
di dalam lampirannya, penjelasan juga tetap minim, ditulis dgn tergesa-gesa..
===================== == =terbilang(e3;3;"")
apabila pada tanda "" saya ganti kata menjadi nol atau puluhmaka otomatis semua berubah nol / puluh
mohon penjelasan para suhumatur nuwun
===================== =
mohon maaf saya tidak tahu maksud dari keinginan ini; terutama kata "SEMUA" itu
mewakili apa saja ??
"APA" yg akan diotomatiskan berubah menjadi "nol" / "puluh" ??
sesederhana apa pun sebuah 'program', dia harus ditulis setelah KITA TAHU
sesederhana apa pun sebuah 'program', dia harus ditulis setelah KITA TAHU
/ DAPAT MENDESKRIPSIKAN keinginan kita sendiri, dan keinginan itu harus logis.
di inginkan fungsi terbilang mempunya 3 buah arguments (parameters)
argument # 1 tentunya diharapkan sebuah bilangan / yg dapat diwakili oleh rujukan ke cell
argument # 2 tidak dijelaskan
argument # 3 kurang lengkap penjelasan keinginannya (contoh hasil tidak ditunjukkan)
sementara, baru dapat memenuhi keinginan
7.00 yg dengan UDF lama menghasilkan tujuh koma nol sekarang menjadi Tujuh Koma Nol Nol
semoga bermanfaat
oiya, seluruh code diganti total versi ringkas.
bagian bilangan utuh bisa menghandle sampai 15 digit
Function Terbilang(N As Double) As String
'--siti Vi / newTerbilang sep 2007 -- / refined: dec 30 2009
Dim sN As String, Txt As String, i As Byte
Dim Dasa(2 To 9), Ltak As Variant, Pch As String
Dim Dwi As Byte, Tri1 As Byte, Tri2 As Byte, Tri3 As Byte
Anka = ",satu,dua,tiga,empat,lima,enam,tujuh,delapan,sembilan," & _
"sepuluh,sebelas,dua belas,tiga belas,empat belas,lima belas," & _
"enam belas,tujuh belas,delapan belas,sembilan belas"
Anka = Split(Anka, ",")
Pch = Right(Format(Round(N - Int(N), 2), "0.00"), 2)
For i = 2 To 9: Dasa(i) = Anka(i) & " puluh": Next i
Ltak = Array("ribu", "juta", "milyar", "triliun")
If N > 10 ^ 15 - 1 Then Terbilang = "#err: max 15 digit!": Exit Function
sN = Trim(Str(Int(Abs(N))))
If Int(Abs(N)) = 0 Then Txt = "nol "
If Int(Abs(N)) > 0 Then
i = 0
Do
sN = "000" + sN
Dwi = CByte(Right(sN, 2))
If Dwi > 0 And Dwi < 20 Then
Txt = IIf(N < 2000 And i = 1, "se", Anka(Dwi) + " ") + Txt
Else
Tri3 = CByte(Right(sN, 1))
If Tri3 > 0 Then Txt = Anka(Tri3) + " " + Txt
Tri2 = CByte(Mid(sN, Len(sN) - 1, 1))
If Tri2 > 0 Then Txt = Dasa(Tri2) + " " + Txt
End If
Tri1 = CByte(Mid(sN, Len(sN) - 2, 1))
If Tri1 = 1 Then Txt = "seratus " + Txt
If Tri1 > 1 Then Txt = Anka(Tri1) + " ratus " + Txt
sN = Left(sN, Len(sN) - 3)
If CDbl(sN) > 0 Then
Txt = IIf(CInt(Right(sN, 3)) = 0, "", Ltak(i) + " ") + Txt
i = i + 1
End If
Loop While CDbl(sN) > 0 And i < 5
End If
Terbilang = WorksheetFunction.Proper(Trim(Txt) & " " & Pecahan(Pch))
End Function
'--siti Vi / newTerbilang sep 2007 -- / refined: dec 30 2009
Dim sN As String, Txt As String, i As Byte
Dim Dasa(2 To 9), Ltak As Variant, Pch As String
Dim Dwi As Byte, Tri1 As Byte, Tri2 As Byte, Tri3 As Byte
Anka = ",satu,dua,tiga,
"sepuluh,sebelas,
"enam belas,tujuh belas,delapan belas,sembilan belas"
Anka = Split(Anka, ",")
Pch = Right(Format(
Ltak = Array("ribu"
If N > 10 ^ 15 - 1 Then Terbilang = "#err: max 15 digit!": Exit Function
sN = Trim(Str(Int(
If Int(Abs(N)) = 0 Then Txt = "nol "
If Int(Abs(N)) > 0 Then
i = 0
Do
sN = "000" + sN
Dwi = CByte(Right(
If Dwi > 0 And Dwi < 20 Then
Txt = IIf(N < 2000 And i = 1, "se", Anka(Dwi) + " ") + Txt
Else
Tri3 = CByte(Right(
If Tri3 > 0 Then Txt = Anka(Tri3) + " " + Txt
Tri2 = CByte(Mid(sN, Len(sN) - 1, 1))
If Tri2 > 0 Then Txt = Dasa(Tri2) + " " + Txt
End If
Tri1 = CByte(Mid(sN, Len(sN) - 2, 1))
If Tri1 = 1 Then Txt = "seratus " + Txt
If Tri1 > 1 Then Txt = Anka(Tri1) + " ratus " + Txt
sN = Left(sN, Len(sN) - 3)
If CDbl(sN) > 0 Then
Txt = IIf(CInt(Right(
i = i + 1
End If
Loop While CDbl(sN) > 0 And i < 5
End If
Terbilang = WorksheetFunction.
End Function
Private Function Pecahan(NN As String)
Dim n1 As String, n2 As String
n1 = Left(NN, 1)
n2 = Right(NN, 1)
If n1 = "0" Then n1 = "nol" Else n1 = Anka(Val(n1))
If n2 = "0" Then n2 = "nol" Else n2 = Anka(Val(n2))
Pecahan = "Koma " & n1 & " " & n2
End Function
Dim n1 As String, n2 As String
n1 = Left(NN, 1)
n2 = Right(NN, 1)
If n1 = "0" Then n1 = "nol" Else n1 = Anka(Val(n1)
If n2 = "0" Then n2 = "nol" Else n2 = Anka(Val(n2)
Pecahan = "Koma " & n1 & " " & n2
End Function
----- Original Message -----From: Setyo aji HutomoSent: Tuesday, December 29, 2009 9:21 AMSubject: ]] XL-mania [[ enol atau puluh
saya ada sedikit permasalahan dengan rumus macro : file terlampir
__._,_.___
+-:: XL-mania ::::::::::::::::::::----------------------------------+
| Hoo... Hoo... Hoo... Merry Christmas! Happy Holiday! |
| http://www.facebook.com/group.php?gid=37671048001&ref=mf |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message, melecehkan, tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan winzip jika perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/ |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau... |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html |
+-------------------------------------------------------------------+
| Message lama ada di : |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id] |
| http://www.mail-archive.com/xl-mania@yahoogroups.com |
+-------------------------------------------------------------------+
| Hoo... Hoo... Hoo... Merry Christmas! Happy Holiday! |
| http://www.facebook.com/group.php?gid=37671048001&ref=mf |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message, melecehkan, tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan winzip jika perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/ |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau... |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html |
+-------------------------------------------------------------------+
| Message lama ada di : |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id] |
| http://www.mail-archive.com/xl-mania@yahoogroups.com |
+-------------------------------------------------------------------+
MARKETPLACE
.
__,_._,___
Nenhum comentário:
Postar um comentário