Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
ecvel vba求質數問題!
Jun 12th 2013, 23:51

我要做一題用EXCEL VBA求出質數1-1000,可是遇到了幾個問題.....
Sub AA()
Dim M As Integer
Dim N As Integer
For M = 1 To 1000
For N = 2 To M / 2
temp = M Mod N
If temp = 0 Then
Exit For
End If
Next N
If temp 0 Then
temp1 = temp1 & "," & M
End If
Next
Cells(1, 1) = temp1
End Sub

照理說,最小的一個質數應該是2呀...為什麼我的跑出來2都不見了呀??而且怎麼都會往橫的擠在同一個儲存格,我該怎麼把它分開儲存格呢?如果跑出來的所有數字,我要在最總和,請問要怎麼總和呢? 懇請熟悉VBA的高手們,幫幫我吧!感激不盡了~

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - https://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
創作者介紹
創作者 電影心得::::灣生回家線上看免費紀錄片 , 灣生回家 上映 , 灣生回家 心得 , 灣生回家 線上看 , 灣生回家 紀錄片何時上映 , 灣生回家的故事 , 的頭像
thigosf

電影心得::::灣生回家線上看免費紀錄片 , 灣生回家 上映 , 灣生回家 心得 , 灣生回家 線上看 , 灣生回家 紀錄片何時上映 , 灣生回家的故事 ,

thigosf 發表在 痞客邦 留言(0) 人氣( 0 )