我想寫一個簡單的Excel VBA函數從給定的單元格中取一個數字並分配一個等級,然後在當前活動單元格中寫入該值。在Excel VBA中的循環引用
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
一旦調用在Excel「=級(A2)」我得到的錯誤消息 有一個或多個圓形的引用,其中一個公式是指其自身小區直接或間接的影響。
我錯過了什麼?
變化'activecell.value =''到等級=' – Zerk