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: 8
Default Help with Visual Basic

I'm new to Visual Basic. By trial and error, I keyed in the following code
to determine the price of a Call Option, given stock price, exercise price,
current yield, dividend yield, std. deviation & days to maturity.

Although the function works, I want to create an additional function for Put
Option Price. Many of the same intermediate calculations are used again (eg.
d1, d2, Nd1 and Nd2). How do I code so that I don't have to repeat all this?

Thanks for your help!


Function CallPrice(PS, PE, YTM, DIV, SD, DAYS)
d1 = (Log(PS / PE) + (YTM - DIV + 0.5 * SD ^ 2) * DAYS / 365) / SD /
Sqr(DAYS / 365): d2 = d1 - SD * Sqr(DAYS / 365): Nd1 =
WorksheetFunction.NormSDist(d1): Nd2 = WorksheetFunction.NormSDist(d2):
CallPrice = PS * Nd1 * Exp(-DIV * DAYS / 365) - PE * Nd2 * Exp(-YTM * DAYS /
365)
End Function


 
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
Visual Basic cil Excel Discussion (Misc queries) 3 January 11th 10 04:27 AM
Is Visual Basic the same as Visual Studio 2008? Mike Stewart Excel Worksheet Functions 5 January 11th 09 04:58 PM
New to Visual Basic Need help with sumif Excel Discussion (Misc queries) 3 November 11th 08 07:46 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM
Visual Basic Adrian Tucker Excel Programming 3 July 25th 03 04:57 AM


All times are GMT +1. The time now is 04:32 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"