Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
21Activity
0 of .
Results for:
No results containing your search query
P. 1
Membuat Fungsi Terbilang Di Excel Dengan VBA

Membuat Fungsi Terbilang Di Excel Dengan VBA

Ratings: (0)|Views: 1,540 |Likes:
Published by moch-i w
look that's just manfaat
look that's just manfaat

More info:

Published by: moch-i w on Jan 28, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as RTF, PDF, TXT or read online from Scribd
See more
See less

02/15/2013

pdf

text

original

 
Membuat Fungsi Terbilang di Excel dengan VBA Jika pada contoh sebelumnya dibahas mengenai pembuatan fungsiterbilang dengan menggunakan Visual Basic, kali ini akan dibahas mengenaipembuatan fungsi yang sama namun diterapkan pada Excel 2003 dan dibangundengan memanfaatkan fitur VBA (Visual Basic for Application).Bukalah sebuah worksheet Excel kemudian aktifkan menu Tools > Macro >Visual Basic Editor atau dengan kombinasi tombol Alt+F11. Hal tersebut akanmemicu munculnya Visual Basic Editor yang ada pada lingkungan Excel (gambar1).Klik kanan pada item VBAProject (Book1) yang terdapat pada jendelasebelah kiri. Pada menu yang muncul pilih Insert > Module. Bandingkan dengangambar 2. Tambahkan kode program seperti tertulis pada listing 1 ke dalam modultersebut.Listing 1. Fungsi terbilang dengan VBAOption ExplicitPublic Function Terbilang(x As Double) As StringDim tampung As DoubleDim teks As StringDim bagian As StringDim i As IntegerDim tanda As BooleanDim letak(5)letak(1) = "ribu "letak(2) = "juta "letak(3) = "milyar "letak(4) = "trilyun " If (x = 0) ThenTerbilang = "nol"Exit FunctionEnd If If (x < 2000) Thentanda = TrueEnd If teks = ""If (x >= 1E+15) ThenTerbilang = "Nilai terlalu besar"Exit FunctionEnd If For i = 4 To 1 Step -1tampung = Int(x / (10 ^ (3 * i)))If (tampung > 0) Thenbagian = ratusan(tampung, tanda)
 
teks = teks & bagian & letak(i)End If x = x - tampung * (10 ^ (3 * i))Nextteks = teks & ratusan(x, False)Terbilang = teksEnd FunctionFunction ratusan(ByVal y As Double, ByVal flag As Boolean) As StringDim tmp As DoubleDim bilang As StringDim bag As StringDim j As IntegerDim angka(9)angka(1) = "se"angka(2) = "dua "angka(3) = "tiga "angka(4) = "empat "angka(5) = "lima "angka(6) = "enam "angka(7) = "tujuh "angka(8) = "delapan "angka(9) = "sembilan "Dim posisi(2)posisi(1) = "puluh "posisi(2) = "ratus "bilang = ""For j = 2 To 1 Step -1tmp = Int(y / (10 ^ j))If (tmp > 0) Thenbag = angka(tmp)If (j = 1 And tmp = 1) Theny = y - tmp * 10 ^ jIf (y >= 1) Thenposisi(j) = "belas "Elseangka(y) = "se"End If bilang = bilang & angka(y) & posisi(j)ratusan = bilangExit FunctionElsebilang = bilang & bag & posisi(j)End If End If y = y - tmp * 10 ^ jNext

Activity (21)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
epin_id liked this
raffrizal liked this
sigit81 liked this
Arif Efendi liked this
udiths liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->