Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with ngs T. Valko Excel Worksheet Functions 2 January 6th 10 12:05 AM
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
Problems with IRM Aaron West Charts and Charting in Excel 0 June 28th 05 09:27 PM
Tab Key problems ESL in Tyler Excel Discussion (Misc queries) 2 March 21st 05 11:01 PM
VBA problems Andrew Clark Excel Discussion (Misc queries) 3 March 16th 05 09:33 PM


All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"