Create a command button (B6) and assign it to a code that writes the first 20 elements of the Fibonacci sequence in range D6:D25 (the first two elements of the sequence are 0 and 1; after that, each subsequent number is the sum of the two previous numbers). Run

50 0

Get full Expert solution in seconds

$1.97 ONLY

Unlock Answer




Private Sub CommandButton1_Click()
Dim a, b, c, i As Integer
a = 0
b = 1
Cells(6, 4) = a
Cells(7, 4) = b

For i = 8 To 25
c = a + b
Cells(i, 4) = c
a = b
b = c
Next i

End Sub