Public Function buah(x, nomor As Byte, jenis As Byte) As Variant
 ' created by: sukiyanto@gmail.
 ' x(index), index dimulai angka 1
 ' x(1) = Apel Hijau Malang
 ' x(2) = 1500
 Dim namabuah(255) As String
 Dim qtybuah(255) As Integer
 Dim hargabuah(255) As Integer
 
 urut = 1
     For i = 1 To x.Count
         bh = " " & x(i) & " "
         bh = Replace(bh, " Buah ", "", 1, -1, vbTextCompare)
         bh = Trim(bh) & "  "
         bh2 = Split(bh, " ")
         bh = bh2(0) & " " & bh2(1)
         For j = 1 To urut
             If namabuah(j) = "" Then
                 namabuah(j) = bh
                 urut = urut + 1
                 j = urut
             ElseIf namabuah(j) = bh Then
                 j = urut
             End If
         Next
         i = i + 1
     Next i
     
     urut = urut - 1
     
     For i = 1 To x.Count
         For j = 1 To urut
             If InStr(1, x(i), namabuah(j), vbTextCompare) > 0 Then
                 qtybuah(j) = qtybuah(j) + 1
                 hargabuah(j) = hargabuah(j) + x(i + 1)
             End If
         Next
         i = i + 1
     Next i
     
     If jenis = 0 Then
         buah = namabuah(nomor)
     ElseIf jenis = 1 Then
         buah = qtybuah(nomor)
     Else
         buah = hargabuah(nomor) / qtybuah(nomor)
     End If
 End Function
 
| Member ke 13,013 siapa ya? Sini mau dikirimin coklat :D |
| Member ke 31,031 dapet iPod dehh.... :D :D :D |
| 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 |
+-------------------------------------------------------------------+
 
 
Nenhum comentário:
Postar um comentário