Private Function sum_factor(n As Integer) As Long Dim i As intege, s As Integer, j As Integer Do While i < n / 2 i = i + 1 If n Mod i = 0 Then s = s + i End If Loop sum_factor = s End Function