Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems with LN in VBA
I am trying to create this function
Function CalcWeibX(N As Double, B As Double, Fx As Double) As Double Dim Power As Double Power = 1 / B CalcWeibX = -N * ((Application.WorksheetFunction.Ln(1 - Fx)) (Power)) End Function But all I keep getting is a "Invalid Procedure Call or Argument". VBA won't allow me to have a Real number on both LN argument an Power. If I run LN(0.5)^2, it works If I run LN(2)^(0.5), it works But If I have real numbers on both arguments (Ex: LN(0.5)^0.2), I ge the error. Am I doing something wrong here, I think it should work. I've tried both Excel LN function and VBAs Log function and both giv same error and I get something about not finding Excel Power functio if I try to use Application.WorksheetFunction.Power instead of the ^. Best Regards Noo -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems with LN in VBA
But If I have real numbers on both arguments (Ex: LN(0.5)^0.2), I get
the error. Am I doing something wrong here, I think it should work. If I am not mistaken, a Negative number (Log(.5)) raised to .2 is a "Complex Number." You can probably see it a little better with... =IMPOWER(LN(0.5),0.2) Function CalcWeibX(N As Double, B As Double, Fx As Double) As Double CalcWeibX = -N * (Log(1 - Fx) ^ (1 / B)) End Function HTH Dana DeLouis "NooK " wrote in message ... I am trying to create this function Function CalcWeibX(N As Double, B As Double, Fx As Double) As Double Dim Power As Double Power = 1 / B CalcWeibX = -N * ((Application.WorksheetFunction.Ln(1 - Fx)) ^ (Power)) End Function But all I keep getting is a "Invalid Procedure Call or Argument". VBA won't allow me to have a Real number on both LN argument and Power. If I run LN(0.5)^2, it works If I run LN(2)^(0.5), it works But If I have real numbers on both arguments (Ex: LN(0.5)^0.2), I get the error. Am I doing something wrong here, I think it should work. I've tried both Excel LN function and VBAs Log function and both give same error and I get something about not finding Excel Power function if I try to use Application.WorksheetFunction.Power instead of the ^. Best Regards NooK --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problems with ngs | Excel Worksheet Functions | |||
aauugghhh...#div/o problems & various average formula problems | Excel Worksheet Functions | |||
Problems with IRM | Charts and Charting in Excel | |||
Tab Key problems | Excel Discussion (Misc queries) | |||
VBA problems | Excel Discussion (Misc queries) |