here is my self defined fun

  • Thread starter Thread starter =?iso-2022-jp?B?RVhDRUwbJEIhIRsoQk5FV1M=?=
  • Start date Start date
?

=?iso-2022-jp?B?RVhDRUwbJEIhIRsoQk5FV1M=?=

hi,

here is my self defined fun .

Function t1(sita As Double, t0 As Double, l0 As Double) As Double
sita = (sita - 90) / 180 * 3.14159265
t1 = t0 - l0 * Tan(sita)
End Function 'ok

but when i use it in worksheet ,as =T1(95,7.5,20) ,it #REF!s.

when i change t1 to tt1,it works well.

why

thanks
 
I believe it is because "T1" looks like a Cell reference to Excel. Excel
will usually not work with any names on a worksheet that looks like a Cell
Reference. Your "tt1" is not a cell reference, so that is why it works.
With your 90 shift, it's too bad Excel does not have a Cotangent function.

Function MyT1(Sita As Double, t0 As Double, l0 As Double) As Double
Const Pi As Double = 3.14159265358979
MyT1 = t0 + l0 / Tan((Pi * Sita) / 180)
End Function

HTH
Dana DeLouis
 
Back
Top