Fibonacci Marker macro
Is there a macro that can run through a list of numbers say 1-100 and high lite the Fibonacci patterns or umber sequences The range would be A3:F:2000
thanks is for your help
Haven't done one of these in a while and you'll have to re-indent in the right places ...
Option Explicit
Option Base 1
Sub Fibonacci__Marker()
'by time*treat, Dec 31, 2016'
'Looks through a rectangular grid of numbers and'
'colors the cells containing Fibonacci (or other preferred) values'
'This beta version works on the active sheet and is not yet completely idiot-proof. :^)'
'It doesn't handle merged cells, but checks for non-numeric text.'
'Written/tested in Excel 2003'
Dim Fibonacci__List() As Variant, positions As Long, Fib__Flag As Boolean
Dim upper__row As Long, left__col As Long
Dim lower__row As Long, right__col As Long
Dim working__row As Long, working__col As Long
Dim marking__color As Long, caution__color As Long
Const light__green As Long = 35
Const light__orange As Long = 40
marking__color = light__green
caution__color = light__orange
Fibonacci__List = Array(1, 2, 5, 8, 13, 21, 34, 55, 89)
upper__row = 3: left__col = 1
lower__row = 2000: right__col = 6
For working__row = upper__row To lower__row
For working__col = left__col To right__col
Fib__Flag = False
If IsNumeric(Cells(working__row, working__col).Value) Then
For positions = 1 To 9 'number of items in Fibonacci__List array'
If Cells(working__row, working__col).Value = Fibonacci__List(positions) Then
Cells(working__row, working__col).Interior.ColorIndex = marking__color
Fib__Flag = True
Exit For 'positions'
End If
Next positions
If Fib__Flag = False Then Cells(working__row, working__col).Interior.ColorIndex = xlNone
Else
Cells(working__row, working__col).Interior.ColorIndex = caution__color
End If 'IsNumeric'
Next working__col
Next working__row
Cells.Columns.AutoFit 'optional'
End Sub