Tecnologia, programação e muito Visual FoxPro.

sexta-feira, 7 de maio de 2010

Re: ]] XL-mania [[ bilangan prima

 

maaf ada yg salah
pada UDF IsPrimeNumber
 
ada kalimat pembuka Loop
   For Devisor = 2 To aNumber
 
seharusnya
   For Devisor = 2 To aNumber - 1

----- Original Message -----
From: siti Vi
Sent: Friday, May 07, 2010 4:01 PM
Subject: Re: ]] XL-mania [[ bilangan prima

Dim ArrDevisors()
 
Sub BlaBlaBlaBla()
   ' siti Vi / bluewater, indonesia / 7 May 2010
   Dim MyCell As Range
   Dim isPrima As String, n As Long
   Set MyCell = Selection
   isPrima = IsPrimeNumber(MyCell.Value)
   MyCell(1, 4) = "Result:"
   MyCell(1, 5) = isPrima
   If isPrima = "NON-PRIMA" Then
      For n = 1 To UBound(ArrDevisors)
      MyCell(1 + n, 5) = ArrDevisors(n)
      Next n
   End If
End Sub
 
Private Function IsPrimeNumber(aNumber As Long) As String
   ' siti Vi / bluewater, indonesia /14 Dec 2005
   Dim AreYou As Boolean
   Dim Devisor As Long
   Dim i As Long
   AreYou = True
   For Devisor = 2 To aNumber
      If aNumber Mod Devisor = 0 Then
         AreYou = False
         i = i + 1: ReDim Preserve ArrDevisors(1 To i)
         ArrDevisors(i) = Devisor
      End If
   Next
   If aNumber = 0 Then AreYou = False
   IsPrimeNumber = IIf(AreYou, "PRIMA", "NON-PRIMA")
End Function
 
'--- sebelum menjalankan makro (Sub prosedur BlaBlabla)
'--- select dulu sebuah cell yg berisi Bilangan yg akan di olah.

 
----- Original Message -----
From: L- Van
Sent: Wednesday, May 05, 2010 9:03 AM
Subject: ]] XL-mania [[ bilangan prima
Master suhu xl,
gimana cara saya menentukan suatu bilangan itu prima atau bukan..
jika saya memasukan angka dikolom C3, misal 7 maka hasil di G3 adalah NONPRIMA
dan hasil bilangan yang keluar hanya angka 1 dan 7

jika ada cara dengan makro juga tidak apa2..
thanks,
L-van

__._,_.___
Recent Activity:
+-:: XL-mania ::::::::::::::::::::----------------------------------+
| uaaaaa... mau game maeeemoooooooo....                             |
| 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

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.


Get great advice about dogs and cats. Visit the Dog & Cat Answers Center.


Hobbies & Activities Zone: Find others who share your passions! Explore new interests.

.

__,_._,___

Nenhum comentário:

Arquivo do blog