I have been trying to include some sort of conditional formatting within the function code in Excel. However, I am having trouble getting it to work. Anyone have any idea why the code below will not work:

Function Compare(First As Double, Second As Double)

Dim Row As Integer
Dim Col As Integer

ActiveCell.Select

If ((First - Second) > 0.1) Or ((First - Second) < -0.1) Then

Compare = "ERROR"
ActiveCell.Interior.ColorIndex = 3
ActiveCell.Interior.Pattern = xlSolid

Else

Compare = "OK"

End If

End Function