Click here to Skip to main content
15,902,926 members

Comments by rehnam (Top 5 by date)

rehnam 8-Sep-11 7:56am View    
Public Function xirrValue(ByVal NumericValues, ByVal DateValues, byval GuessIRR ) As Double

' Bunch of code here followed by calling the XIRR function

xirrValue = CDbl(XLAPP.Run("XIRR", NumericValues, DateValues, GuessIRR))


End Function




This function worked fine in Excel 2003. Now that I have opened the file in 2007, xirrValue is no longer working properly.
The code works fine upto the line where it calls the in built XIRR function.
I have enabled Macros in Excel 2007 and also installed the Add-In that contains the built-in XIRR function.
The XIRR function works properly byitself. I am only having trouble with my user defined xirrValue function.

Any help would be very much appreciated.
Thanks.
rehnam 29-Apr-11 0:42am View    
@SAKryukov: I think you want me to think that i am confused. My problem is not how to display the values. I am well aware of format functions. My problem is with the rounding part itself, as the users has to follow certain rules (4 dp for qty and 8 dp for dealvalue). Thank tou all for ur comments anyway.
rehnam 29-Apr-11 0:30am View    
@SA: Who needs rounding? I need. Thats why i posted this question.
Thats a rule everyone of our our users has to follow in a particular scenario where quantity is calculated. Quantity has to be rounded off to 4 decimal places and Dealvalue to 8 decimal places. It cannot exceed that.
rehnam 28-Apr-11 9:04am View    
if i use var res = 1580.12345678D / 11D, then too i'll get the same result. But i want "res" to be rounded to 4 digits. Thats what get saved to database. And in update mode, i get the rounded value only.
rehnam 28-Apr-11 8:58am View    
Starting is not supposed to be an integer. if the val is 1580.12345678, i need to get it back too.