2
Contributors
2
Replies
18
Views
4 Years
Discussion Span
Last Post by joeyliew7
0

Something like this should work:

Private Function ABC(ByVal xyz As Integer) As Integer
    If xyz = 0 Then
        ABC = 0
    Else
        ABC = xyz + ABC(xyz - 1)
    End If
End Function

It's hard to be 100% sure since the code you submitted isn't consistent, and you haven't mentioned what exactly you're trying to do with the code. However it does look like you're trying get the sum of all the digits preceding the input down to 0. If that is the case this code will work. For instance inputting a value of 10 produces an output of 55.

Edited by tinstaafl

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.