MobileMobile | Continue

Excel Bar

Excel Bar

Your excel questions will be responsed by our excel experts within 24hrs.Our service is free.

 Forgot Pass?
 Register Now
Find
Hot Search: Vlookup Match VBA
View: 459|Reply: 7

Vba code for creating Fibonacci Series [SOLVED]

[Copy link]

1

Topics

3

Posts

9

Integral

Newbie

Rank: 1

Integral
9
Post on 9-21-2016 05:34:26 | All posts |Read mode
I want to create Fibonacci series using FOR….NEXT in VBA and want to throw an input box to user to enter the number till when he want this series.
Suppose he enter 10 then i want the output as 1,1,2,3,5,8,13,21,34,55....




Reply

Props Report

11

Topics

662

Posts

1497

Integral

King

Rank: 6Rank: 6

Integral
1497
Post on 9-21-2016 06:02:55 | All posts




Sub
Fibonacci_Series()
   
   
Dim
til, l, m, n, strResult$
   
    till = Application.InputBox(Length of series? , Fibonacci Series, Type:=1)
   
If
till = 0
Then

Exit

Sub
   
    n = 1
    strResult = 1,
   
For
i = 1
To
till - 1
        l = n
        n = n + m
        m = l
        strResult = strResult  n  ,
   
Next
    strResult = Left(strResult, Len(strResult) - 2)
   
    MsgBox strResult, , Fibonacci Series
   
End

Sub





Reply Support Opposition

Props Report

13

Topics

884

Posts

1937

Integral

King

Rank: 6Rank: 6

Integral
1937
Post on 9-21-2016 06:08:00 | All posts



Here is an alternate solution that give you the results in a spreadsheet.  Just a different twist to the same answer.








Attached Files


  • Fibonacci.xls
    (43.0 KB, 114 views)
    Download















  • Reply Support Opposition

    Props Report

    1

    Topics

    3

    Posts

    9

    Integral

    Newbie

    Rank: 1

    Integral
    9
     Author| Post on 9-21-2016 06:31:23 | All posts



    Thanks Dear For your help :-)




    Reply Support Opposition

    Props Report

    1

    Topics

    3

    Posts

    9

    Integral

    Newbie

    Rank: 1

    Integral
    9
     Author| Post on 9-21-2016 06:52:56 | All posts



    Thanks Friend for yout help






    Reply Support Opposition

    Props Report

    0

    Topics

    1

    Posts

    4

    Integral

    Newbie

    Rank: 1

    Integral
    4
    Post on 9-21-2016 07:52:45 | All posts



    PLEASE! NEED A LOT OF HELP!
    Need to create a macro enabled button that will prompt the user to enter the first two numbers in a Fibonacci sequence and the total number of elements in the sequence. Then display the results of the sequence in a series of message boxes.
    THANK YOU!
    Reply Support Opposition

    Props Report

    0

    Topics

    1

    Posts

    4

    Integral

    Newbie

    Rank: 1

    Integral
    4
    Post on 12-12-2017 04:09:29 | All posts
    alansidman posted on 9-21-2016 06:08
    Here is an alternate solution that give you the results in a spreadsheet.  Just a different twist ...

    Thank you so much alansidman. This is a big help for me that don't know how to make program in vba-excel. God bless and more power.
    Reply Support Opposition

    Props Report

    0

    Topics

    1

    Posts

    4

    Integral

    Newbie

    Rank: 1

    Integral
    4
    Post on 1-21-2018 06:09:29 | All posts
    Hey guys I need help who can write a VBA code for me? I need a code which will do this, if I press "Button 1" rangeE1 will write 1 if I press again number one then rangeE2 will write 2 if I press again that button rangeE3 will write 3...
    Who can help me?
    Reply Support Opposition

    Props Report

    Points policy of this forum

    Archiver|Mobile|Small dark house|Contact us|Excel Bar

    GMT-5, 2-22-2018 23:04 , Processed in 0.384217 second(s), 20 queries .

    Powered by Discuz! X3

    © 2001-2013 Comsenz Inc.

    !fastreply! Top !return_list!