07/06/29 01:26:15
>>262
Public Function kfact(n As Integer) As Integer
Dim i As Integer
Dim xx As Integer
i = 1
xx = 1
Do While i < n
xx = xx * i
i = i + 1
Loop
'↓これ追加(戻り値)
kfact = xx
End Function
ちなみに階乗なら=fact()って関数あるけど
それじゃダメなん?
VBAで使うならApplication.WorksheetFunction.Fact()ね