[VBA ] 印出 1~100 質數
Public Sub test()
Dim c As Range, i As Integer, a As Integer
Range("A1").Value2 = 2
Range("A2").Value2 = 3
i = 5
For Each c In Range("A3:A100")
ccc:
For a = 3 To 100
While (a < i)
If i Mod a = 0 Then GoTo ccc
a = a + 2
Next a
c.Value = i
i = i + 2
Next i
End Sub
請問問題出在那???
請幫忙
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.52.130.231
※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1492145106.A.322.html
噓
04/14 14:42, , 1F
04/14 14:42, 1F
噓
04/14 21:27, , 2F
04/14 21:27, 2F
→
04/14 21:48, , 3F
04/14 21:48, 3F
→
04/14 21:53, , 4F
04/14 21:53, 4F
→
04/14 21:53, , 5F
04/14 21:53, 5F
→
04/17 07:58, , 6F
04/17 07:58, 6F
→
04/19 22:23, , 7F
04/19 22:23, 7F
推
04/21 13:56, , 8F
04/21 13:56, 8F
→
04/21 14:01, , 9F
04/21 14:01, 9F
→
04/21 14:01, , 10F
04/21 14:01, 10F
→
04/21 14:05, , 11F
04/21 14:05, 11F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章