Anything started from reading
RSS icon Email icon Home icon
  • Macro Excel: Membuat fungsi terbilang

    Posted on August 23rd, 2009 me 10 comments

    Pengguna MS Excel yang sering menggunakannya untuk hitung keuangan, mungkin sangat ingin dari hasil yang diperoleh ada tambahan kalimat yang menyebutkan jumlah hasil perhitungan. Misal hasil perhitungan: Rp 1.000.000,- , muncul kalimat: Satu Juta Rupiah.

    Dibawah kami bantu untuk merealisasikan keinginan tersebut. Kode ini saya peroleh dari internet yang ditujukan untuk pengguna openoffice. Setelah saya tes di Excel ternyata dapat berfungsi dengan baik.

    Pekerjaan mengubah dari angka menjadi kalimat seperti diatas disebut FUNGSI TERBILANG. Fungsi terbilang akan tercatat dalam daftar function di excel dalam kelompok user defined, artinya fungsi yang dibuat oleh pengguna.

    Ok kita mulai ya…

    Langkah 1: Buka Workbook Excel.

    Buka Book baru

    Buka Book baru

    Langkah 2: Buka Visual Basic Application Editor. Alt+F11 atau melalui menu menu Tools.

    Membuka VBA Editor di Excel

    Membuka VBA Editor di Excel

    Hasil membuka VBA editor seperti gambar dibawah.

    VBA Editor telah aktif

    VBA Editor telah aktif

    Langkah 3: Membuka MODUL baru.

    Membuka Modul Baru

    Membuka Modul Baru

    Hasil insert modul, akan tersedia modul yang siap dipakai.

    Modul baru siap dipakai

    Modul baru siap dipakai

    Langkah 4: Mengisi Modul dengan script Fungsi berikut, dengan copy dan paste ke dalam modul.

    Function TeksKeAngka(ByVal n As Double) As String
    Dim sSatuan()
    Dim s As String
    sSatuan() = Array("nol", "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", "dua puluh")
    s = ""
    If n > 999 and n < 200 Then
    s = "seribu"
    n = n MOD 1000
    If n = 0 Then
    TeksKeAngka = s
    Exit Function
    End If
    s = s & " "
    End If
    If n > 199 Then
    s = s & sSatuan(Fix(n / 100)) & " ratus"
    n = n MOD 100
    If n = 0 Then
    TeksKeAngka = s
    Exit Function
    End If
    s = s & " "
    End If
    If n > 99 and n < 200 Then
    s = "seratus"
    n = n MOD 100
    If n = 0 Then
    TeksKeAngka = s
    Exit Function
    End If
    s = s & " "
    End If
    If n > 20 and n < 100 Then
    s = s & sSatuan(Fix(n / 10)) & " puluh"
    n = n MOD 10
    If n = 0 Then
    TeksKeAngka = s
    Exit Function
    End If
    s = s & " "
    End If
    TeksKeAngka = s & sSatuan(n)
    End Function

    Function Terbilang(ByVal n) As String
    Dim sBil()
    sBil = Array( "", "ribu", "juta", "milyar", "triliun", "quadriliun")
    Dim i As Integer
    Dim iInt As Integer
    Dim s As String
    Dim dInt As Double
    dInt = Fix(n)
    If (dInt < 2000) Then
    Terbilang = TeksKeAngka(CInt(dInt))
    Exit Function
    End If
    i = 0
    s = ""
    Do While dInt > 0
    iInt = CInt(dInt - Fix(dInt / 1000) * 1000)
    If iInt <> 0 Then
    If Len(s) > 0 Then s = " " & s
    s = TeksKeAngka(iInt) & " " & sBil(i) & s
    End If
    i = i + 1
    dInt = Fix(dInt / 1000)
    Loop
    Terbilang = s
    End Function

    Copy script Fungsi Terbilang Ke Modul

    Copy script Fungsi Terbilang Ke Modul

    Langkah 5:  Tes fungsi di Worksheet Excel.

    Melakukan tes fungsi terbilang

    Melakukan tes fungsi terbilang

    Hasil testing seperti dibawah.

    Hasil fungsi Terbilang bekerja dengan baik

    Hasil fungsi Terbilang bekerja dengan baik

    Langkah 6: SIMPAN BOOK tersebut, dan gunakan book tersebut jika akan digunakan untuk aktifitas perhitungan. Karena Fungsi HANYA melekat atau akan aktif pada workbook tersebut, bukan pada aplikasi MS Excel secara permanen. Atau jika Anda sudah memiliki workbook yang sudah ada hasil hitungan dan ingin ditambahi fungsi terbilang bisa mengikuti langkah 1-6.

    Selesai. Selamat mencoba.

    Dan silakan dicoba file excelnya yang saya buat.

    Other Search Terms:
    fungsi terbilang excel,fungsi macro excel,fungsi terbilang vba,macro excel terbilang,fungsi terbilang di excel,macro terbilang,software terbilang,modul macro excel,modul excel macro,function kurang di excel.
  • Free Software : Audio Editor (limited time)

    Posted on February 23rd, 2009 me No comments
    Free Software: Limited time edition

    Free Software: Limited time edition

    GIVEAWAY TODAY (terbatas hari ini, Gratis).  Kalau Anda tertarik dengan Software untuk edit Audio Gratis, ini ada kesempatan. Tapi Terbatas hingga jam 12.00. Ayooo buruan download.

    Description: Audio Editor is a powerful yet easy-to-use audio editor that will allow anyone to easily edit, record and mix audio files, apply sound effects, convert audio to various formats. The interface of the program is designed so that both a newbie and a professional in audio technologies could work with Audio Editor with equal comfort.

    • Fast and simple to use
    • Full featured Mp3 editing software support
    • Sound editing functions include cut, copy, paste, delete, silence, and more
    • Apply special effects, such as fade, equalizer, doppler, mechanize, echo, reverse, flanger, and more

    DOWNLOAD SAIKI ….!