Fungsi Terbilang pada Excell

Digunakan untuk menterjemahkan nilai ke kata-kata

Digunakan di Excell atau di Open Office 2.0

Used : =tebilang(A1)

 

  • Public Function terbilang(a As Range)
  • Dim bil1 As Variant, bil2 As Variant
  • Dim ratusan As Variant, ratusan1 As Variant
  • Dim i As Variant, j As Variant, k As Variant
  • Dim l As Variant, m As Variant, n As Variant
  • Dim formula As Variant
  • i = a
  • Do While i > l
  • Select Case i
  • Case Is >= 1000000000000#
  • j = 1000000000000#
  • bil2 = “TRILIAR “
  • Case Is >= 1000000000
  • j = 1000000000
  • bil2 = “MILIAR “
  • Case Is >= 1000000
  • j = 1000000
  • bil2 = “JUTA “
  • Case Is >= 1000
  • j = 1000
  • bil2 = “RIBU “
  • Case Is >= 1
  • j = 1
  • bil2 = ” “
  • End Select
  • k = Int(i / j)
  • l = k
  • ratusan = “”
  • Do While l > 0
  • Select Case l
  • Case Is >= 1000
  • m = 1000
  • ratusan2 = “RIBU “
  • Case Is >= 100
  • m = 100
  • ratusan2 = “RATUS “
  • Case Is >= 10
  • m = 10
  • ratusan2 = “PULUH “
  • Case Is >= 1
  • m = 1
  • ratusan2 = “”
  • End Select
  • n = Int(l / m)
  • If m >= 10 And m < 100 Then
  • Select Case n
  • Case 1
  • ratusan1 = “SE”
  • Case 2
  • ratusan1 = “DUA “
  • Case 3
  • ratusan1 = “TIGA “
  • Case 4
  • ratusan1 = “EMPAT “
  • Case 5
  • ratusan1 = “LIMA “
  • Case 6
  • ratusan1 = “ENAM “
  • Case 7
  • ratusan1 = “TUJUH “
  • Case 8
  • ratusan1 = “DELAPAN “
  • Case 9
  • ratusan1 = “SEMBILAN “
  • End Select
  • Else
  • Select Case n
  • Case 1
  • If m >= 10 Then
  • ratusan1 = “SE”
  • Else
  • ratusan1 = “SATU “
  • End If
  • Case 2
  • ratusan1 = “DUA “
  • Case 3
  • ratusan1 = “TIGA “
  • Case 4
  • ratusan1 = “EMPAT “
  • Case 5
  • ratusan1 = “LIMA “
  • Case 6
  • ratusan1 = “ENAM “
  • Case 7
  • ratusan1 = “TUJUH “
  • Case 8
  • ratusan1 = “DELAPAN “
  • Case 9
  • ratusan1 = “SEMBILAN “
  • Case 10
  • ratusan1 = “SEPULUH “
  • Case 11
  • ratusan1 = “SEBELAS “
  • Case 12
  • ratusan1 = “DUA BELAS “
  • Case 13
  • ratusan1 = “TIGA BELAS “
  • Case 14
  • ratusan1 = “EMPAT BELAS “
  • Case 15
  • ratusan1 = “LIMA BELAS “
  • Case 16
  • ratusan1 = “ENAM BELAS “
  • Case 17
  • ratusan1 = “TUJUH BELAS “
  • Case 18
  • ratusan1 = “DELAPAN BELAS “
  • Case 19
  • ratusan1 = “SEMBILAN BELAS “
  • End Select
  • End If
  • ratusan = ratusan & ratusan1 & ratusan2
  • l = l – (m * n)
  • Loop
  • bil1 = ratusan
  • i = i – (j * k)
  • formula = formula & bil1 & bil2
  • Loop
  • formula = “# ” + formula + ” RUPIAH #”
  • terbilang = formula
  • End Function

 

 

This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s