#value error in simple VBA formula. Please help!

cbeadles

New Member
Joined
Dec 17, 2013
Messages
3
I'm receiving a #VALUE error when I attempt to run the following function on my worksheet. Specifically, I am told that "a value used in the formula is of the wrong data type"

both the ubeta unlever and relever fuctions that I call internally in this function run just fine on their own so I don't think the issue is with them.

Does anyone know what might be causing this error to occur? I've been staring at it for about an hour and can't seem to figure it out (bear with me I'm new)

Thanks

Chris

Function WACC(cbeta As Double, CDebtAsset As Double, ODebtAsset As Double, m As Double, rf As Double, CostOfDebt As Double, CorpTax As Double)
Dim ubeta As Double
Dim WACCbeta As Double
Dim re As Double

ubeta = Application.unlever(cbeta, CorpTax, CDebtAsset)
WACCbeta = Application.Relever(ubeta, CorpTax, ODebtAsset)
re = rf + WACCbeta * (m - rf)

WACC = ((1 - ODebtAsset) * re) + (ODebtAsset * CostOfDebt * (1 - CorpTax))

End Function
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I'm surprised you don't get "Object doesn't support this property or method"

What happens when you take off the Application. ??
 
Upvote 0
I'm surprised you don't get "Object doesn't support this property or method"

What happens when you take off the Application. ??

When I take off the "Application." it still gives me the same error. After some research online I guess there isn't much difference between calling the function with/without it
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top