View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default User defined function gives #NAME?

Not too sure. It worked for me. I did clean it up a bit but the gist of it is
the same...

Function SigTest(cell1 As Range, cell2 As Range, cell3 As Range, cell4 As
Range) As String
If (cell1 - cell2) ^ 2 / (cell3 ^ 2 + cell4 ^ 2) 3.841447 Then
SigTest = "*"
Else
SigTest = ""
End If
End Function

I am assuming that the functions is stored in a regular code module and not
a sheet or thisworkbook. If so then that would be the culprit...
--
HTH...

Jim Thomlinson


"John Wirtr" wrote:

I've writtena User Defined Function that yields #NAME? when I use it in a
spread sheet. Why is this? The code for the function is below.

The code is in a module in PERSONAL.xls. I have also tried it in a module
in the workbook where it is used. Same result.

This UDF used to work for me. What am I doing wrong?

John Wirt

Function SigTest(cell1, cell2, cell3, cell4)
Dim testval As Long
testval = (cell1 - cell2) * (cell1 - cell2)
testval = testval / (cell3 * cell3 + cell4 * cell4)
If testval 3.841447 Then
SigTest = "*"
Else
SigTest = ""
End If
End Function