korhan
Board Regular
- Joined
- Nov 6, 2009
- Messages
- 215
Hi,
Can anybody tell me why this code is crashing and also suggest a more efficient code maybe?
Can anybody tell me why this code is crashing and also suggest a more efficient code maybe?
Code:
<code>
Function Factors(x As Double) As String
Application.Volatile
Dim i As Double
Factors = x
For i = x - 1 To 1 Step -1
If x - (Int(x / i) * i) = 0 Then
Factors = Factors & ", " & i
Debug.Print Factors
End If
Next i
End Function
Sub Test()
Call Factors(600851475143#)
End Sub
</code>
Last edited: