I have a simple UDF which returns a boolean result of either true or false. It works properly and consistently when run within the VBA module; however, when I include the UDF in the actual worksheet it returns a #VALUE error.
Sub testFunction()
Dim myRow As Integer
myRow = 34
MsgBox RowCompleted(myrRow)
End Sub
'FUNCTION TO DETERMINE LAST ROW WITH DATA
Function LastRow() As Integer
LastRow = Sheets("BIBLE").Range("I:I").Find(what:="*", LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
End Function
'FUNCTION TO DETERMINE IF ROW IS COMPLETED
Function RowCompleted(r As Integer) As Boolean
If r <= LastRow - 2 Then
RowCompleted = True
Else: RowCompleted = False
End If
End Function
When I utilize the function within the worksheet, I enter the following formula:
What might be causing the #Value error?