LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 187
Default calculating weighted average cost of capital in a macro

I'm trying to write a macro to calculate the weighted average cost of
capital, based on values inputted by the user who executes the macro.
Following is the code I have but it occurs to me that this looks
rather ungainly. Is there a better way to write code of this sort:

Sub CalculateWACC()
Dim MyString1 As String, MyString2 As String
Dim MyString3 As String, MyString4 As String
Dim MyString5 As String
'Prompts the user for values to input to calculate the weighted
average
'cost of capital, based on the formula
'c = (E/K) * y + (D/K) * b(1 - t)
'whe K = D + E
'c = weighted average cost of capital (%)
'y = required or expected return on equity (%)
'b = required or expected return on borrowings (%)
't = corporate tax rate (%)
'D = total debt and leases (currency)
'E = total equity and equity equivalents (currency)
'K = total capital invested in the going concern (currency)
MyString1 = Application.InputBox("enter required or expected
return on equity")
MyString2 = Application.InputBox("enter required or expected
return on debt")
MyString3 = Application.InputBox("enter corporate tax rate")
MyString4 = Application.InputBox("enter total debt and leases")
MyString5 = Application.InputBox("enter total equity and equity
equivalents")
Worksheets("Analysis").Range("A1") = MyString1
Worksheets("Analysis").Range("A2") = MyString2
Worksheets("Analysis").Range("A3") = MyString3
Worksheets("Analysis").Range("A4") = MyString4
Worksheets("Analysis").Range("A5") = MyString5
Worksheets("Analysis").Range("A6") = "SUM(A4+A5)"
End Sub

Thanks

 
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
Calculating Weighted Average sfmoored Excel Worksheet Functions 7 February 28th 11 03:36 AM
Calculating a weighted average in a pivot table mrogge Excel Discussion (Misc queries) 1 April 16th 09 06:15 PM
calculate weighted average of stock cost Tim Excel Worksheet Functions 14 May 25th 07 11:33 PM
calculating a weighted average using formula bob green Excel Worksheet Functions 1 August 1st 05 10:33 PM
Can you calculate "weighted average cost of capital? Dennis Excel Discussion (Misc queries) 1 June 20th 05 07:33 AM


All times are GMT +1. The time now is 03:50 AM.

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

About Us

"It's about Microsoft Excel"