I'm trying to write a simple Excel VBA function to take a number from a given cell and assign a grade then write the value in the current active cell.
Public Function Grade(rng As Range)
Dim number As Double
number = rng.Value
If number >= 75 Then
ActiveCell.Value = "A"
ElseIf number >= 60 Then
ActiveCell.Value = "B"
ElseIf number >= 50 Then
ActiveCell.Value = "C"
ElseIf number >= 45 Then
ActiveCell.Value = "D"
ElseIf number < 45 Then
ActiveCell.Value = "F"
End If
End Function
Upon calling '=Grade(A2)' in Excel I get the error message There are one or more circular references where a formula refers to its own cell either directly or indirectly.
What am I missing?
activecell.value =tograde =- Zerk