A Simple Macro: Fibonacci Numbers

When learning a new (computer) language - it is important to have a good mastery of the basics. Developing simple functions like this is what is called for here.

Function Fibonacci(Val As Integer) As Long
Dim I As Integer
Fibonacci = 1
For I = 1 To Val
Fibonacci = Fibonacci * I
Next I
End Function

We can now call our newly created function from the spreadsheet - just like the builtin OOo Calc functions.

fibonacci.jpg

Leave a Reply