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: 93
Default UDF, Category, Data Type, Format, Using

I've written a UDF that calculates the P&I payment for a loan.

Public Function PandI(Principal As Long, AIR As Single,
Years As Integer, Optional n As Integer = 12) As Currency
PandI = (Principal * AIR / 100 / n * (1 + AIR / 100 / n)
^ (n * Years)) / ((1 + AIR / 100 / n) ^ (n * Years) - 1)
End Function
Whe
Principal might be: 250000
AIR (Annual Interest Rate) might be: 4.875
Years might be: 30
n (number of payments per year) is usually: 12
The result will be 1323.0206

I thought giving it data type currency would make it display as
$1,323.02 but that doesn't happen unless I format the cell.

The function is in my Personal.xls. It appears in the Paste
Function Dialog (Function Wizard) in Category:All as
Personal.xls!PandI.
Following instructions from a book, I put the following
procedure in a module in Personal.xls.
Public Sub Auto_Open()
Application.MacroOptions macro:="PandI", Category:=1
End Sub
but I get an error and it doesn't work.
Also, is it possible to make it so that the function can be
used on the worksheet by just typing "=pandi"?
 
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
A SUB CATEGORY USING DATA VALIDATION? ALRDY USNG DV FOR CATEGORY sameer Excel Discussion (Misc queries) 2 January 11th 10 12:55 PM
find location of maximum and get the category type Pablo Excel Discussion (Misc queries) 4 September 27th 08 05:16 PM
Format Category Labels Jampot Charts and Charting in Excel 2 September 19th 07 06:40 PM
Format a column wihtout using "Format-Cells-Number-category-etc" serve Excel Worksheet Functions 4 February 24th 06 12:54 AM
Adding new 'Type' to Format->Number->Time->Type Chip Pearson Excel Discussion (Misc queries) 5 September 26th 05 08:45 PM


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